Stuff It
Nov 4th, 2009, 12:06 PM
How can I send null objects down a channel?
In the following example MyServiceActivator.myMethod returns null. I want this null object to be sent down the 'output' channel and to my outbound-channel-adapter but currently it doesn't get published at all.
<channel id="input"/>
<channel id="output"/>
<service-activator ref="MyServiceActivator"
method="myMethod" input-channel="input" output-channel="output"/>
class MyServiceActivator
{
// this method can return an object or a null value
Object myMethod(Object obj) {
return null;
}
}
<outbound-channel-adapter ref="OutboundAdapter" channel="output" method="publish"/>
class OutboundAdapter
{
void publish(Object obj) {
// want to receive 'null's
}
}
How can I get around this integration restriction?
In the following example MyServiceActivator.myMethod returns null. I want this null object to be sent down the 'output' channel and to my outbound-channel-adapter but currently it doesn't get published at all.
<channel id="input"/>
<channel id="output"/>
<service-activator ref="MyServiceActivator"
method="myMethod" input-channel="input" output-channel="output"/>
class MyServiceActivator
{
// this method can return an object or a null value
Object myMethod(Object obj) {
return null;
}
}
<outbound-channel-adapter ref="OutboundAdapter" channel="output" method="publish"/>
class OutboundAdapter
{
void publish(Object obj) {
// want to receive 'null's
}
}
How can I get around this integration restriction?