You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Michele Mazzucco <Mi...@ncl.ac.uk> on 2006/05/02 11:45:58 UTC

Re: axis2 - asynchronous messaging

Hi Deepal,

I've got just a question after your explanation: how can B forward the
message to node N? I mean, which header should B modify/set to obtain
that result (please note also that several N nodes can exist, but only B
is aware of that)?


Thanks in advance,
Michele

Deepal Jayasinghe wrote:
> Hi Michele ;
> 
> I am sorry for late reply.
> pls see my in line comments
> 
> Michele Mazzucco wrote:
> 
>> Hi all,
>>
>> I would like to use the callback features, but my architecture uses a
>> piece of software acting like a "broker" to handle incoming requests:
>>
>>
>>       A              B
>> Client ----------> Broker ---------> Node satisfying the request (N)
>>  |                     |
>>  |                             |
>>  |          C (reply)         |
>>  <---------------------------------------
>>
>>
>> Can the node N use the callback to return the result to the client?
> 
> yes it can , but as I understood without using callback you can achieve
> the same goal,  correct me if im wrong
>   step1:
>     A send a request to B by putting address of B as TO and Address of A
> as ReplyTo , and invocation of the A should be sendReceiveNonBlocking
> 
>   strp 2 :
>    When B gets the req and it does whatever processing and forward that
> to Node N and that invocation can be  fireAndForget invocation (B will
> not change replyTo address)
>   step 3:
>    Once N get the request it will process the message and send the
> response to A since message has replyTo address.
>    (if the invocation at the N takes long time , then you can use
> AsyncMessageReciver , which uses call back inside that)
> 
>> If no, what should I do? Could fireAndForget() messages (A, B and C)
>> be fine (in case together with options like relatesTo, messageId, etc.)?
> 
> If A is client running inside a Server then you can just call
> fireAndForget at A , by putting replyTo addresses as server address.
> 
>> Any suggestions are welcome.
>>
>>
>>
>> Thanks in advance,
>> Michele
>>
>>
> 

Re: axis2 - asynchronous messaging

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Hi Deepal,

how is it possible to solve this issue if the method is not void?, I
mean, given the nodes

client --> A --> B
   <------------

if the ws method is defined in A and it is not void, does your solution
work?


ServiceA {

	OMElement foo(OMElement argument) {
		process the request, change headers, etc.

		sender.fireAndForget(payload);
		
		and now what happens?, what value should I return?
}


ServiceB {

	// used to receive the request from 'A'
	// (the method has the same signature as the one defined in ServiceA)
	OMElement foo(OMElement argument) {
		satisfies the request
		...
		sends the result to 'client'
	}
}



Thanks,
Michele

Deepal Jayasinghe wrote:
> When B gets a message he has a corresponding  messageContext for that
> message , and that message context will have all the required addressing
> information. So what you have to do is , create a new message context by
> coping the stuff that you need. Btw are you going to just forward the
> SOAP message or going to modify that ?
> 
> In either case , Create a new message context , and copy the SOAP
> envelope  to it , and set the wsa:To (to erp) in the new message context
> , then create an operation client , finlay send the message using
> OperationClient. In simple term your scenario boils down as follows;
>   A send a request to B , so A is the client B is the server ,
> next B send a rer to N , so B become the client and N become the server ,
> so simply think B as a client :)
> 
> Michele Mazzucco wrote:
> 
>> Hi Deepal,
>>
>> I've got just a question after your explanation: how can B forward the
>> message to node N? I mean, which header should B modify/set to obtain
>> that result (please note also that several N nodes can exist, but only B
>> is aware of that)?
>>
>>
>> Thanks in advance,
>> Michele
>>
>> Deepal Jayasinghe wrote:
>>  
>>
>>> Hi Michele ;
>>>
>>> I am sorry for late reply.
>>> pls see my in line comments
>>>
>>> Michele Mazzucco wrote:
>>>
>>>    
>>>
>>>> Hi all,
>>>>
>>>> I would like to use the callback features, but my architecture uses a
>>>> piece of software acting like a "broker" to handle incoming requests:
>>>>
>>>>
>>>>      A              B
>>>> Client ----------> Broker ---------> Node satisfying the request (N)
>>>> |                     |
>>>> |                             |
>>>> |          C (reply)         |
>>>> <---------------------------------------
>>>>
>>>>
>>>> Can the node N use the callback to return the result to the client?
>>>>      
>>>>
>>> yes it can , but as I understood without using callback you can achieve
>>> the same goal,  correct me if im wrong
>>>  step1:
>>>    A send a request to B by putting address of B as TO and Address of A
>>> as ReplyTo , and invocation of the A should be sendReceiveNonBlocking
>>>
>>>  strp 2 :
>>>   When B gets the req and it does whatever processing and forward that
>>> to Node N and that invocation can be  fireAndForget invocation (B will
>>> not change replyTo address)
>>>  step 3:
>>>   Once N get the request it will process the message and send the
>>> response to A since message has replyTo address.
>>>   (if the invocation at the N takes long time , then you can use
>>> AsyncMessageReciver , which uses call back inside that)
>>>
>>>    
>>>
>>>> If no, what should I do? Could fireAndForget() messages (A, B and C)
>>>> be fine (in case together with options like relatesTo, messageId, etc.)?
>>>>      
>>>>
>>> If A is client running inside a Server then you can just call
>>> fireAndForget at A , by putting replyTo addresses as server address.
>>>
>>>    
>>>
>>>> Any suggestions are welcome.
>>>>
>>>>
>>>>
>>>> Thanks in advance,
>>>> Michele
>>>>
>>>>
>>>>      
>>>>
>>
>>  
>>
> 

Re: axis2 - asynchronous messaging

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Hi Deepal,

probably I don't need to modify the message itself, if it's possible to
add some stuff into the header. Can I?

Thanks,
Michele

Deepal Jayasinghe wrote:
> When B gets a message he has a corresponding  messageContext for that
> message , and that message context will have all the required addressing
> information. So what you have to do is , create a new message context by
> coping the stuff that you need. Btw are you going to just forward the
> SOAP message or going to modify that ?
> 
> In either case , Create a new message context , and copy the SOAP
> envelope  to it , and set the wsa:To (to erp) in the new message context
> , then create an operation client , finlay send the message using
> OperationClient. In simple term your scenario boils down as follows;
>   A send a request to B , so A is the client B is the server ,
> next B send a rer to N , so B become the client and N become the server ,
> so simply think B as a client :)
> 
> Michele Mazzucco wrote:
> 
>> Hi Deepal,
>>
>> I've got just a question after your explanation: how can B forward the
>> message to node N? I mean, which header should B modify/set to obtain
>> that result (please note also that several N nodes can exist, but only B
>> is aware of that)?
>>
>>
>> Thanks in advance,
>> Michele
>>
>> Deepal Jayasinghe wrote:
>>  
>>
>>> Hi Michele ;
>>>
>>> I am sorry for late reply.
>>> pls see my in line comments
>>>
>>> Michele Mazzucco wrote:
>>>
>>>    
>>>
>>>> Hi all,
>>>>
>>>> I would like to use the callback features, but my architecture uses a
>>>> piece of software acting like a "broker" to handle incoming requests:
>>>>
>>>>
>>>>      A              B
>>>> Client ----------> Broker ---------> Node satisfying the request (N)
>>>> |                     |
>>>> |                             |
>>>> |          C (reply)         |
>>>> <---------------------------------------
>>>>
>>>>
>>>> Can the node N use the callback to return the result to the client?
>>>>      
>>>>
>>> yes it can , but as I understood without using callback you can achieve
>>> the same goal,  correct me if im wrong
>>>  step1:
>>>    A send a request to B by putting address of B as TO and Address of A
>>> as ReplyTo , and invocation of the A should be sendReceiveNonBlocking
>>>
>>>  strp 2 :
>>>   When B gets the req and it does whatever processing and forward that
>>> to Node N and that invocation can be  fireAndForget invocation (B will
>>> not change replyTo address)
>>>  step 3:
>>>   Once N get the request it will process the message and send the
>>> response to A since message has replyTo address.
>>>   (if the invocation at the N takes long time , then you can use
>>> AsyncMessageReciver , which uses call back inside that)
>>>
>>>    
>>>
>>>> If no, what should I do? Could fireAndForget() messages (A, B and C)
>>>> be fine (in case together with options like relatesTo, messageId, etc.)?
>>>>      
>>>>
>>> If A is client running inside a Server then you can just call
>>> fireAndForget at A , by putting replyTo addresses as server address.
>>>
>>>    
>>>
>>>> Any suggestions are welcome.
>>>>
>>>>
>>>>
>>>> Thanks in advance,
>>>> Michele
>>>>
>>>>
>>>>      
>>>>
>>
>>  
>>
> 

Re: axis2 - asynchronous messaging

Posted by Deepal Jayasinghe <de...@opensource.lk>.
When B gets a message he has a corresponding  messageContext for that
message , and that message context will have all the required addressing
information. So what you have to do is , create a new message context by
coping the stuff that you need. Btw are you going to just forward the
SOAP message or going to modify that ?

In either case , Create a new message context , and copy the SOAP
envelope  to it , and set the wsa:To (to erp) in the new message context
, then create an operation client , finlay send the message using
OperationClient. In simple term your scenario boils down as follows;
  A send a request to B , so A is the client B is the server ,
next B send a rer to N , so B become the client and N become the server ,
so simply think B as a client :)

Michele Mazzucco wrote:

>Hi Deepal,
>
>I've got just a question after your explanation: how can B forward the
>message to node N? I mean, which header should B modify/set to obtain
>that result (please note also that several N nodes can exist, but only B
>is aware of that)?
>
>
>Thanks in advance,
>Michele
>
>Deepal Jayasinghe wrote:
>  
>
>>Hi Michele ;
>>
>>I am sorry for late reply.
>>pls see my in line comments
>>
>>Michele Mazzucco wrote:
>>
>>    
>>
>>>Hi all,
>>>
>>>I would like to use the callback features, but my architecture uses a
>>>piece of software acting like a "broker" to handle incoming requests:
>>>
>>>
>>>      A              B
>>>Client ----------> Broker ---------> Node satisfying the request (N)
>>> |                     |
>>> |                             |
>>> |          C (reply)         |
>>> <---------------------------------------
>>>
>>>
>>>Can the node N use the callback to return the result to the client?
>>>      
>>>
>>yes it can , but as I understood without using callback you can achieve
>>the same goal,  correct me if im wrong
>>  step1:
>>    A send a request to B by putting address of B as TO and Address of A
>>as ReplyTo , and invocation of the A should be sendReceiveNonBlocking
>>
>>  strp 2 :
>>   When B gets the req and it does whatever processing and forward that
>>to Node N and that invocation can be  fireAndForget invocation (B will
>>not change replyTo address)
>>  step 3:
>>   Once N get the request it will process the message and send the
>>response to A since message has replyTo address.
>>   (if the invocation at the N takes long time , then you can use
>>AsyncMessageReciver , which uses call back inside that)
>>
>>    
>>
>>>If no, what should I do? Could fireAndForget() messages (A, B and C)
>>>be fine (in case together with options like relatesTo, messageId, etc.)?
>>>      
>>>
>>If A is client running inside a Server then you can just call
>>fireAndForget at A , by putting replyTo addresses as server address.
>>
>>    
>>
>>>Any suggestions are welcome.
>>>
>>>
>>>
>>>Thanks in advance,
>>>Michele
>>>
>>>
>>>      
>>>
>
>
>  
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~