synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Fremantle" <pzf...@gmail.com>
Subject Re: Pointing messages at targets
Date Fri, 27 Jul 2007 13:28:13 GMT
Yes and No

The injectMessage API we offer today is asynchronous, so you can block
the mediation waiting for a reply. However, you *can* send a message
anywhere.

So today, if you do this:

mediate(MessageContext sC) {

   SynapseEnvironment se sC.getSynapseEnvironment();
   MessageContext newMessageContext = se.createMessageContext();
   newMessageContext.getEnvelope().getBody().addChild(something);
   newMessageContext.setTo("http://paul.fremantle.org/soap/OneWay");
   se.injectMessage(newMessageContext);
   return true;
}

This will send the message to "http://paul.fremantle.org/soap/OneWay"
if and only if that is how the main sequence in synapse is configured.
In other words, if the main sequence doesn't do <send/> then this
message won't actually go anywhere.

If you wanted to block waiting for a service request or be certain the
message would go out instantly you'd just have to use the normal Axis2
APIs and Synapse wouldn't help you.

Paul

On 7/27/07, Glen Daniels <glen@thoughtcraft.com> wrote:
> Paul Fremantle wrote:
> > The message is going to end up going somewhere. For example, I want
> > the message to go to Amazon s3, but I already have an endpoint
> > definition for S3. I could just set the To address to be
> > http://s3.amazon.com/whatever.
> >
> > However, this doesn't take advantage of the endpoint definitions.
> >
> > Does that make sense?
>
> Not really. :)  But let's forget endpoints for a minute, and imagine
> that I have a standard mediation sequence that sends a copy of a message
> to a notarization server, gets back a "notarized" ID code, then adds
> that code to a header in the message and sends it to its destination.
>
> Original msg (in pseudo-xml):
>
> <header>
>   <wsa:To>http://s3.amazon.com/foo</wsa:To>
>   <signature>signed To header and body</signature>
> </header>
> <body>stuff</body>
>
> I want to be able to do something like:
>
> synapseContext.setSynapseTarget("notarizationSeq");
> synapseContext.setMessage(msg);
> synapse.send(synapseContext);
>
> The post-mediation msg that would get sent to Amazon might look like this:
>
> <header>
>   <wsa:To>http://s3.amazon.com/foo</wsa:To>
>   <signature>signed To header and body</signature>
>   <notarizationID notary="URL">52</notarizationID>
> </header>
> <body>stuff</body>
>
> Can I do something like that, where the Synapse server doesn't have any
> preconfiguration about the actual destinations of the messages?
>
> --Glen
>
> > On 7/27/07, Glen Daniels <glen@thoughtcraft.com> wrote:
> >> Hi Paul:
> >>
> >> Paul Fremantle wrote:
> >>> When I inject a new message into Synapse (using the API).
> >>>
> >>> At the moment messages go into the main sequence. However, it would be
> >>> nice to specify a sequence or endpoint for them to be targeted to.
> >>>
> >>> I'm thinking maybe just setting the To address using a uri scheme
> >>> like: "sequence:stockquote" or "endpoint:sq".
> >>>
> >>> What do you all think?
> >> Doesn't this assume that the message itself is "synapse-aware"?  What
> >> about cases where I want to inject a message that is actually going
> >> wsa:To Amazon S3?
> >>
> >> --Glen
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: synapse-dev-help@ws.apache.org
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message