Open gregturn opened 15 years ago
Pieter van der Meer commented
Modified (copied) versions to implement a fire forget Jms service
Pieter van der Meer commented
Added two files containing the required changes to the original Jms classes. the code removed is after the TODO tags.
Pieter van der Meer commented
Oops forgot to mention that the classes that we created are in the org.springframework.... package structure. The classes use all kinds of variables that are protected.
Tim Azzopardi commented
Close, but not quite:
The attachment JmsFireAndForgetSenderConnection defines onReceiveBeforeRead() which is used by AbstractWebServiceConnection#receive
To finish the job, you need to make a couple methods NOOP in JmsFireAndForgetSenderConnection as follows:
@Override
protected void onReceiveBeforeRead() throws IOException {
// NOOP for fire and forget
}
@Override
protected void onReceiveAfterRead(WebServiceMessage message) throws IOException {
// NOOP for fire and forget
}
@Override
protected boolean hasResponse() throws IOException {
return false;
}
@Override
protected Iterator<String> getResponseHeaderNames() throws IOException {
// NOOP for fire and forget
return new ArrayList<String>().iterator();
}
@Override
protected Iterator<String> getResponseHeaders(String name) throws IOException {
// NOOP for fire and forget
return new ArrayList<String>().iterator();
}
@Override
protected InputStream getResponseInputStream() throws IOException {
// For Fire and forget, should never be called
throw new IllegalStateException("Fire and Forget Jservice should not need a ResponseInputStream");
}
Tim Azzopardi commented
Sorry try again:
@Override
protected void onReceiveBeforeRead() throws IOException {
// NOOP for Fire and forget
}
@Override
protected void onReceiveAfterRead(WebServiceMessage message) throws IOException {
// NOOP for Fire and forget
}
@Override
protected boolean hasResponse() throws IOException {
return false;
}
@Override
protected Iterator<String> getResponseHeaderNames() throws IOException {
// NOOP for Fire and forget
return new ArrayList<String>().iterator();
}
@Override
protected Iterator<String> getResponseHeaders(String name) throws IOException {
// NOOP for Fire and forget
return new ArrayList<String>().iterator();
}
@Override
protected InputStream getResponseInputStream() throws IOException {
// For Fire and forget, should never be called
throw new IllegalStateException("Fire and Forget Jservice should not need a ResponseInputStream");
}
Abhijeet Patil commented
will this feature (IN Only WS client) be available in the next release?
Pieter van der Meer opened SWS-511 and commented
In Spring WS there is a lack of support for fire and forget services, eventhough this is not a problem, a simple extension of the WebServiceTemplate and this can be solved. The implementation of the JmsMessageSender and JmsSenderConnection are coded in such a manner that a response destination must be specified. When no response destination is specified a temporary queue is created in the MOM. The creation of the response destionation by the application is (usally not allowed).
Creating extenstion of the classes JmsMessageSender and JmsSenderConnection proves to be more more difficult them expected. Most method in these classes are protected. In order to supply your own implementation of the JmsMessageSender and JmsSenderConnection the classes must be copied and changed for our own needs. only a few lines are changed.
making the current implementation more open allows for better (read easier) extension.
Affects: 1.5.6
Attachments:
2 votes, 4 watchers