Reputation: 6622
In my current scenario I have two webservices, hereby described:
<jaxws:endpoint id="backendService"
implementor="com.foo.soap.BackendServiceImpl"
address="/BackendService" />
<jaxws:endpoint id="frontendService"
implementor="com.foo.soap.FrontendServiceImpl"
address="/FrontendService" />
Backendservice listens for some background applications to notify progress, while frontendservice allows foreground applications to know if data is ready. So, to put it very simply:
public Interface Backendservice{
public void done(Long reqID); //sets backendservice status to true for that request ID
}
public Interface FrontendService{
public boolean isDone(Long reqID); //returns true if that request was completed
}
What is the best way to exchange that boolean value among two webservices? I'd think about a Singleton class and thus having something like this:
public void done(Long reqID){
Singleton.getInstance().setStatus(reqID, true);
}
public boolean isDone(Long reqID){
return Singleton.getInstance().getStatus(reqID);
}
but is this the best way? Or spring/cxf provide some better way?
Upvotes: 0
Views: 41
Reputation: 52185
You could have an underlying database which contains your reqID
and its current status.
Using a singleton would most likely mean that you will be storing stuff in memory, which might not make your application scale very much. You will also loose everything once the application shuts down and/or have to implement a persistence mechanism.
Upvotes: 1