Get the Message Type in JMS - IBM MQ

user3387609

I am building an application which reveives message from a Message Queue , Process it and and send the generated response to another queue. I have successfully built the same.

But, before sending the msg I must get the Correlation ID, Message ID and Message Type from it, So that I will be able to set these in my generated response msg as well.

I have fetched CorrelationID and Message ID using the below code.

               Message Requestmessage = ReceiveMessage(queueName);
               String correlationID = Requestmessage.getJMSCorrelationID();
               String messageID = Requestmessage.getJMSMessageID();

How will I get the Message Type. There are 5 types of Messages as far as I understood. 1. Text Message 2. Byte Message 3. Stream Message 4. Object Message 5. Map Message All I need is, to find out which type my "Requestmessage" belongs to.

Thanks in Advance.

user3387609

Found the answer. I used instanceof keyword.

        if(Requestmessage instanceof TextMessage )
        {
             //
        }

        if(Requestmessage instanceof BytesMessage)
        {
            //
        }
        if(Requestmessage instanceof ObjectMessage)
        {
            //          
        }
        if(Requestmessage instanceof StreamMessage)
        {
            //
        }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

SOAP & IBM MQ JMS

Trying to setup MQ with a GET message off the queue (not JMS)

IBM MQ get topic name from message in subscription queue

How to get message constantly from remote IBM MQ

Unable to get message from queue in IBM websphere MQ

How to Get message count in a durable subscriber in IBM MQ?

Problem Connecting a Java Client (JMS) to a IBM MQ

Spring Integration with WebSphere JMS IBM MQ provider

Connecting to IBM MQ using CCDT file in JMS

Send message from MQ to EMS(JMS) queue

Unable to put message in ibm mq using container

Swift Message IBM MQ Testing using Jmeter

IBM MQ Pubsub message too large

how to get JMS payload and header Message and queue type

How to get message from a queue hosted in another queue manager in IBM MQ cluster

IBM MQ Client: Should I commit after each Get to prevent other clients receiving same message

Issue with Connecting IBM MQ Using Externalized User Credential - Spring Boot + JMS + IBM MQ 8.0.0.9

com.ibm.mq.MQQueue vs. com.ibm.mq.jms.MQQueue?

Any way to change message format in MQ Console (IBM MQ docker)?

IBM MQ - SSL Encrypted Message Browsable in MQ Explorer

Use JMS 2.0 to use delivery delay with IBM MQ

Why does JMS acknowledge mode not work in wildly with ibm mq?

Not able to stop an IBM MQ JMS consumer in Spring Boot

Spring `jms:listener-container` and IBM MQ backout queues

Is it possible to connect to a locally running IBM MQ Light with Java and JMS?

JMeter JMS Publisher IBM MQ Java.lang.NoClassDefFoundError

JMS-Loadtest using Gatling: unable to initialize ContextFactory of IBM MQ

Detecting disconnect using mq-jms-spring from IBM

'CachingConnectionFactory(jakarta.jms.ConnectionFactory)' cannot be applied to '(com.ibm.mq.jms.MQConnectionFactory)'

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  3. 3

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    Do Idle Snowflake Connections Use Cloud Services Credits?

  9. 9

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  10. 10

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  11. 11

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  12. 12

    Generate random UUIDv4 with Elm

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  17. 17

    EXCEL: Find sum of values in one column with criteria from other column

  18. 18

    Pandas - check if dataframe has negative value in any column

  19. 19

    How to use merge windows unallocated space into Ubuntu using GParted?

  20. 20

    Make a B+ Tree concurrent thread safe

  21. 21

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

HotTag

Archive