[ 
https://issues.apache.org/jira/browse/SYNAPSE-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912406#action_12912406
 ] 

Hiranya Jayathilaka commented on SYNAPSE-580:
---------------------------------------------

Hi Eric,

This is indeed a very interesting idea. But unfortunately the Synapse NHTTP 
architecture does not allow this. The NHTTP transport attempts to stream the 
message content through the ESB as the message is read from the wire. In order 
to determine the message size the transport should fully read a message. But by 
that time the corresponding message context could be half way into the 
mediation engine. So any custom mediators you have developed may or may not see 
the message size property, depending on at which point of the time the 
transport completes reading a message.

The JMX MBeans we have in place get around this problem by 'late reporting' the 
message size values. For instance the request size for a connection is reported 
when the corresponding response is sent out. At this point it is guaranteed 
that the ESB has fully read the message content of the requesy. But needless to 
say that for your purpose this is way too late. So as of now we don't have any 
way of implementing this feature.

Thanks,
Hiranya


> Expose message size metrics from transports to mediation level (as message 
> property)
> ------------------------------------------------------------------------------------
>
>                 Key: SYNAPSE-580
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-580
>             Project: Synapse
>          Issue Type: New Feature
>          Components: Transports
>            Reporter: Eric Hubert
>            Assignee: Hiranya Jayathilaka
>
> To be able to analyse traffic it should be possible to write custom mediators 
> which use exposed transport metrics which e.g. contain information about 
> message sizes without having to go for an additional round of message 
> serialization.
> Any code written on the mediation layer, something like:
> Parameter synEnvParam = 
> messageContext.getConfiguration().getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_ENV);
> SynapseEnvironment synEnv = (SynapseEnvironment) synEnvParam.getValue();
> TemporaryData serialized = synEnv.createTemporaryData();
> OutputStream out = serialized.getOutputStream();
> try {
>     messageContext.getEnvelope().serialize(out);
> } finally {
>     out.close();
> }
> int messageSize = serialized.getLength(); 
> would add an additional overhead to the system. Instead any transport should 
> expose metrics which can be correlated to actual messages, allowing mediation 
> level code to access those metrics (e.g. as message context property).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to