Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMS Properties for Messages #51

Closed
Micha228 opened this issue Mar 7, 2022 · 11 comments
Closed

JMS Properties for Messages #51

Micha228 opened this issue Mar 7, 2022 · 11 comments
Assignees

Comments

@Micha228
Copy link

Micha228 commented Mar 7, 2022

Hi @matrober-uk

Im migrating right now a java application to a golang microservice architectur but im struggeling a little bit with extracting
JMS Propertys of Messages. We had talked a few weeks ago in a call about the QueueBrowser wich is working fine for me.
But im not able to extract following Propertys of the messages.

  • JMS_IBM_MQMD_Format
  • JMS_IBM_MQMD_CodedCharSetId
  • JMS_IBM_MQMD_MsgType
  • JMS_IBM_MQMD_MsgId
  • JMS_IBM_Format
  • JMS_IBM_Encoding
  • JMS_IBM_Character_Set
  • JMS_Priority
  • JMS_IBM_PutApplType
  • JMSXAppID
  • JMS_IBM_MQMD_ApplOriginData
  • JMSGroupID
  • JMSExpiration
  • JMS_IBM_PutTime
  • JMS_IBM_PutDate

I think in the java library was this archived by setting the Property WMQ_MESSAGE_BODY to WMQ_MESSAGE_BODY_MQ
for the destination.
But in the golang pack i didnt find any options like this.
Is there a possibility to extract these information of JMS messages ?

Best regards

Michael

@matrober-uk
Copy link
Member

Hi @Micha228 - thanks for your questions above. I will check through the list of properties over the next few days to see how straightforward it is to add those in and post a comment back here to confirm.

@Micha228
Copy link
Author

Micha228 commented Mar 7, 2022

Hey @matrober-uk,
thanks a lot for checking. Im looking forward to hear from you.

@matrober-uk
Copy link
Member

Hi @Micha228

I've done a first pass look at the message properties and I have a few questions as follows please:

  1. Where relevant do you need to be able to set all these properties when sending in Golang JMS (e.g. ApplOriginData, CCSID, ApplType, Priority, GroupID/Seq), or is it just about reading those properties for a message that is sent using a different type of client such as Java JMS?
  2. Are you happy to use the "JMS_IBM_" field names to retrieve items such as Format, CCSID, MsgType instead of the "JMS_IBM_MQMD_" style naming, or do you specifically need both?
  3. Similarly for JMS_IBM_MQMD_MsgId, is it ok for you to call GetJMSMessageID() instead to retrieve that value?

Implementation notes (for my reference)

#1 https://www.ibm.com/docs/en/ibm-mq/9.2?topic=mjmomm-mapping-mq-fields-onto-jms-fields-incoming-messages
#2 https://www.ibm.com/docs/en/ibm-mq/9.2?topic=mjmomm-mapping-jms-fields-onto-mq-fields-outgoing-messages
#3 https://www.ibm.com/docs/en/ibm-mq/9.2?topic=application-jms-message-object-properties


JMS field name                     MQMD field             Equivalent?             Notes
---------------------------------------------------------------------------------------------------
JMS_IBM_MQMD_Format                Format                 JMS_IBM_Format
JMS_IBM_MQMD_CodedCharSetId        CodedCharSetId (int)   JMS_IBM_Character_Set            
JMS_IBM_MQMD_MsgType               MsgType (integer)      JMS_IBM_MsgType
JMS_IBM_MQMD_MsgId                 MsgId  (byte[])        JMSMessageID (similar)

JMS_IBM_MQMD_ApplOriginData        ApplOriginData (string)

JMS_IBM_Format                     Format (string)
JMS_IBM_Encoding                   Encoding (int)                                 BytesMessage only (see #2)
JMS_IBM_Character_Set              CodedCharacterSetId (int)                      BytesMessage only (see #2)
JMS_IBM_PutTime                    PutDate (string)
JMS_IBM_PutDate                    PutTime (string)
JMS_IBM_PutApplType                PutApplType (int)

JMS_Priority                       Priority               JMSPriority
JMSExpiration                      JMS_IBM_MQMD_Expiry (related)                  10ths second (e.g. 1 min = 600) so add to PutTimestamp

JMSXGroupID                        GroupId
(JMSXGroupSeq added)               MsgSeqNumber 
JMSXAppID                          PutApplName (string)                           Test to update at: https://github.com/ibm-messaging/mq-golang-jms20/blob/main/applname_test.go#L66

@Micha228
Copy link
Author

Hey @matrober-uk,

  1. In the main thing we need to read this fields for messages wich send by other application.
    We need to have the possibility to set only a few of them activly by our application.
    These would be :
  • JMS_IBM_MQMD_CodedCharSetId
  • JMS_IBM_MQMD_Format
  • JMS_IBM_MQMD_MsgType
  1. I think we will need both JMS_IBM_MQMD and JMS_IBM.
    In the old application for example when we create a message we set the field IBM_JMS_FORMAT. But when we are browsing a queue we will read out IBM_JMS_MQMD_FORMAT. Im not really sure what the difference is. Are the MQMD Fields used internal and the other via JMS Clients ?

  2. For the IBM_JMS_MQMD_MsgId i think it is ok to go with calling GetJMSMessageId()

@matrober-uk
Copy link
Member

Hi @Micha228 - I've attached a branch (https://github.com/ibm-messaging/mq-golang-jms20/tree/header-properties) to this issue that implements the behaviour for 8 of the 16 properties as described here and as below.

Field name                    Example                                                Notes
---------------------------------------------------------------------------------------------------------------------------------------------------------
JMS_IBM_PutDate               msg.GetStringProperty("JMS_IBM_PutDate")               YYYYMMDD
JMS_IBM_PutTime               msg.GetStringProperty("JMS_IBM_PutTime")               HHMMSSTH
JMS_IBM_Format                msg.GetStringProperty("JMS_IBM_Format")                MQSTR
                              msg.SetStringProperty("JMS_IBM_Format", "MYFMT")
JMS_IBM_MQMD_Format           msg.GetStringProperty("JMS_IBM_MQMD_Format")           MQSTR
                              msg.SetStringProperty("JMS_IBM_MQMD_Format", "MYFMT")
JMS_IBM_MQMD_MsgId            msg.GetJMSMessageID()
JMS_IBM_MQMD_ApplOriginData   msg.GetStringProperty("JMS_IBM_MQMD_ApplOriginData")
JMSExpiration                 msg.GetJMSExpiration()
JMSXAppID                     msg.GetStringProperty("JMSXAppID")                     JMSXAppID / PutApplName is set using ConnectionFactory.ApplName

You're welcome to download that branch to try out the behaviour if it's useful, before I get to look at the remaining properties.

@Micha228
Copy link
Author

Hey @matrober-uk,

thanks for your implementation. I have downloaded your branch and give it a test.
Using the fields was working fine for me.
It would be great if you can add the other fields also. Looking forward to hear from you.

Best regards
Michael

matrober-uk added a commit that referenced this issue Mar 20, 2022
@matrober-uk matrober-uk self-assigned this Mar 23, 2022
matrober-uk added a commit that referenced this issue Mar 23, 2022
Support for selected header properties - #51
@matrober-uk
Copy link
Member

Hi @Micha228 - I've merged the full set of changes we discussed into the "main" branch (under PR #52).

Details of the Get/Set options now supported are included in the README in the section on Special header properties supported.

Please can you add a comment to this issue when you've had an opportunity to try out the new features?

@matrober-uk
Copy link
Member

Closing as implemented, included in tag v1.8.0.

Please feel free to comment/reopen if necessary.

@Micha228
Copy link
Author

Micha228 commented Apr 4, 2022

Hey @matrober-uk

thank you very much for implementing.
I will test it and leave a comment. 👍

@Micha228
Copy link
Author

Hey @matrober-uk

i have tested your changes and its working fine for me.
Nice job

@matrober-uk
Copy link
Member

great, thanks for confirming @Micha228 - I'm pleased the new options are working as expected for you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants