You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Milan Tomic <to...@yahoo.com> on 2014/08/13 10:10:12 UTC

Close the circle

I have a request where I call one service and need to get result back. Which is the best way to achive this?

So, I have:

A -> B -> A

I would also have to keep a state in service A and to merge it with response from B. Where should I store my state?

Thank you in advance,
Milan

Re: Close the circle

Posted by David Jencks <da...@yahoo.com>.
hi,

IN a loosely coupled system like this why wouldn't you make all the services stateless and put the state into a context object in the event?

What leads you to use events rather than simply having A call a method on B?  There are some really good reasons to use an event driven architecture (e.g. SEDA), but it is a bit unusual.  Combining event-driven and per-request state stored in a component strikes me as definitely odd.

thanks
david jencks

On Aug 13, 2014, at 5:47 AM, Milan Tomic <to...@yahoo.com> wrote:

> Hello JB
> 
> By the state I mean one object (a variable) that should be saved somewhere in service A and merged with result from service B. Which is recommended way in OSGi to store some key/value pairs?
> 
> I am not using ServiceTracker so far, but I am using events:
> 
> Event e = new Event(Constants.QUEUE_NAME, properties);
> eventAdmin.postEvent(e);
> 
> to do a service communication: A -> B -> A
> 
> TIA,
> Milan
> 
> 
> 
> On Wednesday, August 13, 2014 10:21 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> 
> Hi Milan,
> 
> by state, you mean the current status of the service or the response 
> from the service ?
> 
> Do you use ServiceTracker ?
> 
> Regards
> JB
> 
> On 08/13/2014 10:10 AM, Milan Tomic wrote:
> >
> > I have a request where I call one service and need to get result back.
> > Which is the best way to achive this?
> >
> > So, I have:
> >
> > A -> B -> A
> >
> > I would also have to keep a state in service A and to merge it with
> > response from B. Where should I store my state?
> >
> > Thank you in advance,
> > Milan
> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
> 


Re: Close the circle

Posted by Milan Tomic <to...@yahoo.com>.
Hello JB

By the state I mean one object (a variable) that should be saved somewhere in service A and merged with result from service B. Which is recommended way in OSGi to store some key/value pairs?


I am not using ServiceTracker so far, but I am using events:

Event e = new Event(Constants.QUEUE_NAME, properties);
eventAdmin.postEvent(e);

to do a service communication: A -> B -> A

TIA,
Milan




On Wednesday, August 13, 2014 10:21 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
 


Hi Milan,

by state, you mean the current status of the service or the response 
from the service ?

Do you use ServiceTracker ?

Regards
JB


On 08/13/2014 10:10 AM, Milan Tomic wrote:
>
> I have a request where I call one service and need to get result back.
> Which is the best way to achive this?
>
> So, I have:
>
> A -> B -> A
>
> I would also have to keep a state in service A and to merge it with
> response from B. Where should I store my state?
>
> Thank you in advance,
> Milan

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Close the circle

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Milan,

by state, you mean the current status of the service or the response 
from the service ?

Do you use ServiceTracker ?

Regards
JB

On 08/13/2014 10:10 AM, Milan Tomic wrote:
>
> I have a request where I call one service and need to get result back.
> Which is the best way to achive this?
>
> So, I have:
>
> A -> B -> A
>
> I would also have to keep a state in service A and to merge it with
> response from B. Where should I store my state?
>
> Thank you in advance,
> Milan

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com