0

I have an application in springboot which is using jms to receive messages from ibm mq synchronously i.e., using .receive() method which is running fine, Now, I am implementing another process to run in background to receive async messages which is older than 2 minutes, from same queue which uses @Async and Message driven beans(onMessage()) . My method implementation for mdb is as below:

@Service
@Slf4j
@MessageDriven(mappedName = "REPL.AI", activationConfig = {
        @ActivationConfigProperty(propertyName = "connectionFactoryLookup", propertyValue = "jms/queueConnectionFactory"),
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "port", propertyValue = "1414")})
public class MessageBean implements MessageListener {

    @Autowired
    private AsyncMessageReceiver asyncMessageReceiver;

    @Override
    @Async("AsyncExecutor")
    public void onMessage(Message message) {
        log.info("ONMESSAGE-START");
        TextMessage msg = null;
        try {
            if (message instanceof TextMessage) {
                msg = (TextMessage) message;
                log.info("received an async message");
                asyncMessageReceiver.processIntoText(msg); //calling other method for further processing
            }
        } catch (Exception e) {
            log.error("Exception occurs in onMessage(): " + e);
        }

        log.info("ONMESSAGE-END");
    }

}

Also I have created a listener port '1414' in WAS server console to bind the mdb to port. All configuration is already provided.

problem is, mdb is not receiving any messages from the queue , nor it is throwing any error. I can see in logs

MDB Listener 1414 started successfully for JMSDestination jms/ReplQueue.

after this I dont see any exception and not any incoming messages too,messages have been sent through sender. any pointers for this?

Harsha
  • 87
  • 1
  • 14
  • If this is the same queue that your sync method reads from and you have the async method set with Auto-acknowledge, what is to keep async from consuming messages meant for sync? When you did testing was there messages in the queue? – JoshMc Jan 02 '19 at 05:48
  • Hi JoshMc, its the same queue..I am getting the asynchronous messages from mdb's now. But when synchronous process runs with .receive(1000000) , mdb doesn't work during that time, which is the good part. – Harsha Feb 07 '19 at 09:22

0 Answers0