1
votes

I'm currently implementing a flow on a Spring Integration-based (ver. 3.0.1.RELEASE) application that requires to store messages on a JMS queue to be picked up later. For that, I've been trying to use a Spring Integration JMS Inbound Channel Adapter with a custom selector, and then picking up the message from the queue by changing the JMS selector of the JMSDestinationPollingSource to some matching ID included as a header property.

One of the requirements for this is that I cannot add a new service or a JAVA method, so I've been trying to sort it out using a Control Bus, but keep receiving the same error when I send the message to set the messageSelector to something different.

Inbound Channel Adapter definition:

<int-jms:inbound-channel-adapter id="inboundAdapter"
                                 channel="inboundChannel"
                                 destinationName="bufferQueue"
                                 connection-factory="connectionFactory"
                                 selector="matchingID = 'NO VALUE'">
    <int:poller fixed-delay="1000"/>
</int-jms:inbound-channel-adapter>

Message:

@'inboundAdapter.source'.setMessageSelector("matchingID = 'VALUE'")

Error:

EvaluationException: The method 'public void org.springframework.integration.jms.JmsDestinationPollingSource.setMessageSelector(java.lang.String)' is not supported by this command processor. If usign the Control Bus, consider adding @ManagedOperation or @ManagedAttribute.

Which, AFAIK, means that the JmsDestinationPollingSource class is not Control Bus manageable, as it's not passing the ControlBusMethodFilter.

Is this approach nonviable, or is there something I'm missing? Is there any way to set the selector dynamically using SI XML configuration files only?

1

1 Answers

1
votes

First of all it is strange to use Java tool and don't allow to write code on Java...

But that is your choice, or as you said requirements.

Change the employer! ;-)

That's correct: Control Bus allows only @ManagedOperation and @ManagedAttribute method. Since JmsDestinationPollingSource.setMessageSelector. We can make it like that. But does it make so much sense if we can reach it a bit different approach?

<int:outbound-channel-adapter id="changeSelectorChannel" 
    ref"inboundAdapter.source method="setMessageSelector"/>

where a new selector expression should be as a payload of the Message to this channel.