You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by ant elder <an...@gmail.com> on 2005/10/13 23:19:59 UTC

Mediators require unique MessageContexts?

A question I asked on the IRC was does each mediator invocation really need
a its own MessageContext instance.

I still don't understand why the MC can't be reused amongst mediator
invocations? What am I missing here, whats in each MC that wont be copied or
mustn't be shared? Wouldn't it be quite a bit more efficient to have each
mediator work against the one MC?

Maybe this answer depends on the answer to 'are mediators services'
question.

...ant

Re: Mediators require unique MessageContexts?

Posted by Saminda Abeyruwan <sa...@opensource.lk>.
Hi,

As Deepal said, we can think Mediators as bunch of special services 
living in a service group. If mediators need to share some state accorss 
them, they can use the exiting ServiceGroupContext and stored in the MC.

The life cycle of the MC is per Message basis in Axis2. So withing the 
Axis Engine, if we need to loop again we need to have a fresh MC with 
the old MC's ServiceGroupContext ID as a reference parameter. Thus, when 
the Axis Engine invoke again, it goes throught our SyanpseDispatcher, 
DispatchingChecker and InstanceDispatcher to full up the correct context 
for that rule. So it's always better to have fresh MC.

Saminda

> Hi all;
>
>  
>
> To me invoking multiple mediators for one request is like invoking 
> multiple services in a serviceGroup (in axis2) , therefore if 
> mediators want to share some properties or whatever , they can use 
> ServiceGroupContext to do so not the MC.
>
>  
>
> In Axis2 MC is for one invocation , if some handlers in a flow want to 
> share some data they can use MC to do store them, on the other hand is 
> Axis2 dispatching depends on Descriptions and Contexts are in MC 
> (ServiceDescription , OperationDescription , OperationContext , 
> ServiceContext) , there for it would be better if we can use fresh MC 
> for each Mediator invocation.
>
>
> Thanks,
>  Deepal
>
> ................................................................
> ~Future is Open~
>
>     ----- Original Message -----
>     *From:* ant elder <ma...@gmail.com>
>     *To:* synapse-dev@ws.apache.org <ma...@ws.apache.org>
>     *Sent:* Friday, October 14, 2005 3:19 AM
>     *Subject:* Mediators require unique MessageContexts?
>
>     A question I asked on the IRC was does each mediator invocation
>     really need a its own MessageContext instance.
>
>     I still don't understand why the MC can't be reused amongst
>     mediator invocations? What am I missing here, whats in each MC
>     that wont be copied or mustn't be shared? Wouldn't it be quite a
>     bit more efficient to have each mediator work against the one MC?
>
>     Maybe this answer depends on the answer to 'are mediators
>     services' question.
>
>        ...ant
>


Re: Mediators require unique MessageContexts?

Posted by Deepal Jayasinghe <de...@gmail.com>.
Hi all;

 

To me invoking multiple mediators for one request is like invoking multiple services in a serviceGroup (in axis2) , therefore if mediators want to share some properties or whatever , they can use ServiceGroupContext to do so not the MC.

 

In Axis2 MC is for one invocation , if some handlers in a flow want to share some data they can use MC to do store them, on the other hand is Axis2 dispatching depends on Descriptions and Contexts are in MC (ServiceDescription , OperationDescription , OperationContext , ServiceContext) , there for it would be better if we can use fresh MC for each Mediator invocation.


Thanks,
 Deepal

................................................................
~Future is Open~

  ----- Original Message ----- 
  From: ant elder 
  To: synapse-dev@ws.apache.org 
  Sent: Friday, October 14, 2005 3:19 AM
  Subject: Mediators require unique MessageContexts?


  A question I asked on the IRC was does each mediator invocation really need a its own MessageContext instance. 

  I still don't understand why the MC can't be reused amongst mediator invocations? What am I missing here, whats in each MC that wont be copied or mustn't be shared? Wouldn't it be quite a bit more efficient to have each mediator work against the one MC?

  Maybe this answer depends on the answer to 'are mediators services' question.

     ...ant

Re: Mediators require unique MessageContexts?

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
On Thu, 2005-10-13 at 23:15 +0100, Paul Fremantle wrote:
> Ant
> 
> Each rule applies the appropriate QoS handlers to the MC. So each rule
> is a pass through the Axis Engine. 
> 
> However, I don't know Axis2 internals enough to be sure that requires
> a new MC.

MC's don't live in isolation in Axis2; they come into existence under
the guise of an operation context with a MEP etc.. The concern is that
by re-using the same MC we screw up the guts a bit .. but maybe that can
be addressed. Need to think thru that a bit more.

Sanjiva.



Re: Mediators require unique MessageContexts?

Posted by Paul Fremantle <pz...@gmail.com>.
Ant

Each rule applies the appropriate QoS handlers to the MC. So each rule is a
pass through the Axis Engine.

However, I don't know Axis2 internals enough to be sure that requires a new
MC.

Paul

On 10/13/05, ant elder <an...@gmail.com> wrote:
>
> A question I asked on the IRC was does each mediator invocation really
> need a its own MessageContext instance.
>
> I still don't understand why the MC can't be reused amongst mediator
> invocations? What am I missing here, whats in each MC that wont be copied or
> mustn't be shared? Wouldn't it be quite a bit more efficient to have each
> mediator work against the one MC?
>
> Maybe this answer depends on the answer to 'are mediators services'
> question.
>
> ...ant
>