Sample 252 of WSO2 ESB 2.0.1

maghamravi's picture
Hi All, Is there a way to extend the sample 252(HTTP --> JMS) by returning an instant message to the caller acknowledging the request. The reason being is that the caller of my proxy service is a system which needs a response and as the actual service takes a longer period of time to return the response,it would be preferable to return a sample message acknowledging the request. Any guidance on how to go about with this is highly appreciatable. Thanks Ravi.
indika's picture

Do you want to send a HTTP

Do you want to send a HTTP 100 just after receiving request on synapse and later send complete response? Or Do you want a dummy response just after receiving request on synapse and later send complete response back ? is client an addressable endpoint ?
maghamravi's picture

Hi Indika, I jsut wanted

Hi Indika, I jsut wanted to send a dummy response back to the client as soon as synpase gets a request. Thanks Ravi.
indika's picture

Is it your client an

Is it your client an addressable endpoint so that we can directly call back. Because we cannot send multiple responses on same connection with HTTP. If client is an addressable endpoint , we can do that with separate connection. If your client is JMS , then this should be possible anyway.
maghamravi's picture

Hi Indika, I am sorry if

Hi Indika, I am sorry if I wasnt clear. For sample 251:Swithcing form Http to JMS, what I need is a simple response back to the client on the same connection. So, I basically wanted to publish the incoming message to JMS and then send an instant message back to the client / caller .The actual service takes the message from JMS and performs the necessary action but doesn't return anything. Regarding if the caller is addressable endpoint or not, can you please throw some more light as to how I could determine that. Sorry for bugging u :( thanks Ravi.
indika's picture

Hi Ravi I am attaching a

Hi Ravi I am attaching a sample synapse conf (Note that I didn't run ..but hope works... for any issue let me know).   <definitions xmlns="http://ws.apache.org/ns/synapse">     <proxy name="SampleProxy">         <target>             <inSequence>                 <clone>                     <!--Call actual service-->                   <target>                         <sequence>                             <property action="set" name="OUT_ONLY" value="true"/>                                                           <send>                                 <endpoint>                                     <address uri="jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;                                                        java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616"/>                                 </endpoint>                             </send>                         </sequence>                     </target>                      <!--Dummy Response back to client-->                     <target>                         <sequence>                             <script language="js"><![CDATA[                              mc.setPayloadXML(                              <m:getQuote xmlns:m="http://services.samples/xsd">                                  <m:request>                                      <m:symbol>IBM</m:symbol>                                 </m:request>                               </m:getQuote>);                             ]]></script>                             <property name="RESPONSE" value="true"/>                             <header name="To" expression="get-property('ReplyTo')"/>                             <send/>                             <drop/>                         </sequence>                     </target>                 </clone>             </inSequence>             <outSequence>                 <send/>             </outSequence>         </target>     </proxy> </definitions>   By an adddresable endpoint , I means an EPR for the client so that synapse can call back.   Thanks Indika  
indika's picture

Please replace  following

Please replace  following with what client expect   <m:getQuote xmlns:m="http://services.samples/xsd">                                  <m:request>                                      <m:symbol>IBM</m:symbol>                                 </m:request>                               </m:getQuote>
maghamravi's picture

Works like a charm !!!

Hi Indika, It's working fine. Can you please expain what <property action="set" name="OUT_ONLY" value="true"/> the property would do. Thanks Ravi.
indika's picture

OUT_ONLY - 'true' means the

OUT_ONLY - 'true' means the message is to be marked as an out-only message that does not expect a response Please refer configuration_language.html#property for more - this kind of magic properties Thanks Indika
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)