Hi,

The incoming message to my proxy contains a parent record with many child
records.
I need to send the parent record to an atomic create record service and with
the response from that atomic service I extract a key which I then
subsequently need to use when sending the child records to further atomic
create services.

What I can't not see is how to easily preserve the original message AND wait
for the 1st message to complete, e.g. a clone isn't viable as the sequences
are triggered in parallel and I need to wait for the parent ket from the 1st
create.

Would one approach be to:

1. insert a generated unique message id on input, for use later in the proxy
only
2. clone the message, send the 1st to the create for the parent, keeping the
2nd untouched
3. aggregate based on id created in #1
4. take the unaltered child messages from the 2nd in #2 and use for the
child creates

To me that seems inefficient (I will have approx. 6 'types' of child
records), so I'm wondering if mm overlooking something and/or going against
the grain.


Thanks
Wayne

On Tue, Apr 15, 2008 at 9:51 AM, Ruwan Linton <[EMAIL PROTECTED]>
wrote:

> Hi Wayne,
>
> You should have a look at the callout mediator [1] and also this [2] case
> study, which covers some ground and do something similar. Also you can use
> the SynapseEnvironment.createMessageContext() to get a new message context
> created. You can use java inside groovy and hence this call will be
> possible
> inside groovy as well.
>
> Hope this will help.
>
> [1] - http://synapse.apache.org/Synapse_Samples.html#Callout
> [2] - https://wso2.org/library/3325
>
> Thanks,
> Ruwan
>
> On Tue, Apr 15, 2008 at 1:57 PM, Wayne Keenan <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
> >
> > I think I might be pushing/abusing mediators, by doing more that message
> > manipulation, I'm trying to call endpoint from within a script, and
> would
> > be
> > grateful for some advice.
> >
> > Here is the setup:
> >
> > 1. Synapse
> >
> > a) publishing a predefined WSDL of 'composite' services. e.g.
> > createTroubleTicket.
> > b) a mediator chops up incoming SOAP Payload XML into parent child
> records
> > c) the mediator calls (external) lower level atomic services (e.g.
> create
> > record) for the parent
> > d) the mediator needs to either calculate child id (e.g. sequential
> index)
> > or use the result of parent ids created at runtime
> > e) the mediator calls (external) lower level create record for the
> > children
> >
> > 2. RESTful server for the (external) Atomic services
> > a). create record in a DB (not JPA, uses propritary API to create 1 row
> in
> > an underlying DB)
> >
> >
> > I am writing a Groovy mediator to take the parent and child records and
> > then
> > call the atomic service endpoitns using somehtin glike:
> >
> >    def createEP = mc.getEndpoint("SOME_API_CREATE")
> >    createEP.send(newMc)
> >
> > I've basically got 1a,1b & 2a working, but for 1c-e  trying to create
> the
> > new MessaceContext ('newMc') is perhaps telling me I should not be doing
> > this?
> >
> > I wanted to avoid 'programming in XML' via the declarative Synapse
> > mediators, but perhaps I will have to?
> >
> > Regards
> > Wayne
> >
>
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>

Reply via email to