MQ Duplicating COA IDs??? - Websphere

This is a discussion on MQ Duplicating COA IDs??? - Websphere ; Hi, I have a VB .NET app that is/was successfully writing to MQ. I have an MQLog table in SQL server whose Primary key is the ID that MQ returns to me when I place my message on the queue. ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: MQ Duplicating COA IDs???

  1. MQ Duplicating COA IDs???

    Hi,

    I have a VB.NET app that is/was successfully writing to MQ. I have an
    MQLog table in SQL server whose Primary key is the ID that MQ returns
    to me when I place my message on the queue. Since MQ returns the ID in
    a byte array my VB.NET applications builds a string by CHR() each byte
    value and stores the result in a CHAR() field serving as the primary
    key.

    I ran a test and after about 3100 records were written to MQ and their
    MQID's were written to the database I got a duplicate key error on SQL.


    I assume MQ always returns a unique number so how do I store that value
    in SQL so it can be used as a key. My code uses the COA to verify
    against this table so I can make sure that all transactions sent were
    eventually confirmed.

    Is my converting the byte array to a string doing something that would
    produce duplicates or does MQ recycle it;s ID's?

    Thanks


  2. Re: MQ Duplicating COA IDs???

    This turned out to be a result of using CHR() to convert each "byte"
    and saving the results in a string. (slapping of forehead)

    Since there are nulls and nulls would be dropped using CHR() you
    eventually end up creating a string that you created before.

    My solution was to use the follwing:
    strMQMessageID = BitConverter.ToString(objMQMessage.MessageId)

    Maybe this will help the next guy


    ZRexRider wrote:
    > Hi,
    >
    > I have a VB.NET app that is/was successfully writing to MQ. I have an
    > MQLog table in SQL server whose Primary key is the ID that MQ returns
    > to me when I place my message on the queue. Since MQ returns the ID in
    > a byte array my VB.NET applications builds a string by CHR() each byte
    > value and stores the result in a CHAR() field serving as the primary
    > key.
    >
    > I ran a test and after about 3100 records were written to MQ and their
    > MQID's were written to the database I got a duplicate key error on SQL.
    >
    >
    > I assume MQ always returns a unique number so how do I store that value
    > in SQL so it can be used as a key. My code uses the COA to verify
    > against this table so I can make sure that all transactions sent were
    > eventually confirmed.
    >
    > Is my converting the byte array to a string doing something that would
    > produce duplicates or does MQ recycle it;s ID's?
    >
    > Thanks



+ Reply to Thread