@JmsListener does not receive message asynchronously

394 Views Asked by At

I am new to Solace pubsub+ broker.

I tried to send message using topic and receive message using springboot message listener

@JmsListener(destination = "HelloWorld")
public void handle(Message message)
{
    try
    {
        Date receiveTime = new Date();

        if (message instanceof TextMessage)
        {
            TextMessage tm = (TextMessage) message;
            try
            {
                System.out.println("Message Received at " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(receiveTime)
                                + " with message content of: " + tm.getText());
                
                for(long index =0; index <10000000000L; index++)
                {
                    
                }
                
                System.out.println("..done....");
            } 
            catch (Exception e)
            {
                e.printStackTrace();
            }
        } 
        else
        {
            System.out.println(message.toString());
        }
    } catch (Exception e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

The publisher sends the message continuously for every second, however the consumer receives the message and process it and then it receives the next message. I expect the receiver to receive the message immediately when the publisher push the message.

I connect solace broker with amqp over Jms1 protocol and used org.amqphub.spring maven dependency.

Do i need to configure anything else to receive message asynchronously?

0

There are 0 best solutions below