synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kim Horn" <>
Subject RE: Class Mediator Exception after task schedule
Date Fri, 27 Mar 2009 04:53:35 GMT
Thanks, for that. I have no issue using "new" to create a map; was
really asking about the <send> code.
Someone previously volunteered to create a java class to do a task proxy
send, so they thought it was a good approach; lost track who. So given I
have a message and headers now, any example code to do the send in the
Java would be very helpful.

> "Yes.. but its like going out around and coming back in :)"

But the 
Is doing it anyhow conceptually,  I know not internally. 

All I really want to do is schedule a <sequence> every 15 minutes. I
have no need in the task to call Java; but I am forced to go this low
level, Why ? Synapse allows a sequence to contain Java calls. So why not
let the sequence call the Java, if I do need to just schedule Java code.
But to me Synapse is not about scheduling Java code but about higher
level stuff, <sequences>.  It appears this was a quick way to get Quartz
timers happening in Synapse; let them code Java and not scripting in
Synapse configuration language, Groovy, Javascript, XML etc.

It seem to me scheduling a <sequence> is the right and conceptually
clean approach in Synapse for all tasks. This is the use case for tasks.
Not low level Java Quartz stuff triggering Java code. Can someone
provide an example where scheduling a sequence would not work ?

Cut and paste From the Jeff Davis's book on Open SOA 

<task class="org.apache.synapse.startup.tasks.MessageInjector" #1
<property name="to" #2
<property name="soapAction" value="urn:getOrders"/>
<property name="message"> 
<getOrders xmlns="uri:opensoa.chapter10.order">
<trigger interval="30"/> 
<proxy name="QueuedOrderRequestor" transports="http"> 
<address uri="http://localhost:8280/soap/CustomerOrderQueueService"

To me the fact that the above works is not obvious at all and suggests
using side effects of a system. To work out
how the above works, what is doing the 2 sends ? There is the proxy
message send then the send to the endpoint....
Just seem really strange code to me; strange in that it does not
represent what is going on. Therefore will
End up producing a maintenance nightmaire. Computer languages should
express things clearly.

He really wants a sequence that's <sends> to this URI, every 30 seconds.
It's the same requirement as mine.
Same as example 300. Schedule a sequence that sends the message. This
example should have  the <filter>
Code added.

As suggested elsewhere the code above is an example of an Open Proxy ...
Oops introduced a maintenance/security issue.
But the example suggest the way other people are thinking about clean
"conceptual" ways to use tasks ... 


-----Original Message-----
From: Asankha Perera [] On Behalf Of
Asankha C. Perera
Sent: Friday, 27 March 2009 2:40 PM
Subject: Re: Class Mediator Exception after task schedule

Hi Kim
> Are there any examples of code where I could do the send of the
message in the
> Java task code; create a new messageInjectorSenderMediator ? 
> So add the transport info then do the send.
Hope this helps:

                Axis2MessageContext axis2smc = (Axis2MessageContext)
                org.apache.axis2.context.MessageContext axis2MessageCtx
                Object headers = axis2MessageCtx.getProperty(

                if (headers != null && headers instanceof Map) {
                    Map headersMap = (HashMap) headers;
                    headersMap.put(name, resultValue); // <== adding a 
transport header
                if (headers == null) {
                    Map headersMap = new HashMap();
                    headersMap.put(name, resultValue); // <== adding a 
transport header
> If I send this to a Synapse Proxy then the real sequence is out of
Quartz scope.
Yes.. but its like going out around and coming back in :)


Asankha C. Perera

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message