Message Control ID

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Message Control ID

  • Creator
    Topic
  • #53923
    Kevin Crist
    Participant

      How do you create a unique message ID in the MSH? I was thinking there was a tcl way of doing this but i have never had to do it.

      Any ideas would be great

    Viewing 7 reply threads
    • Author
      Replies
      • #79546
        bill bearden
        Participant

          There are some Tcl (Tclx?) calls for this sort of thing. There is a good thread on this. I’m pretty sure this is covered in the Level 2 class. Good stuff.

          https://usspvlclovertch2.infor.com/viewtopic.php?t=6261

          This thread mentions the Tcl procs you call to do this. When I search our xlates, the call I normally see is something like this in a Pre Proc on an Xlate COPY command:

           set xlateOutVals

            ]

            But I think you have to set up the counter file before you use it.

          1. #79547
            Keith McLeod
            Participant

              You can make use of the cloverleaf message id in an xltp.

              set msgID [xpmmetaget -ro $xlateId MID] ;# gets the message id as a keyed list

              set xlateOutVals “[keylget msgID NUM]” ;# established xlateOutVals value.

            • #79548
              Jim Kosloskey
              Participant

                Kevin,

                As Bill and Keith have pointed out there are many ways to accomplish this in Tcl.

                The real question is how unique does the number need to be. In HL/7 it is hinted the number should be absolutley unique (that is guaranteed to never repeat).

                However, in practice various system have various levels of demand (or maybe none at all).

                We had a system at my last location which exchanged information with virtually every system in the Hospital (and potentially outside) and their requirement was that a Control ID could NEVER repeat EVER!

                So we devised a Tcl proc that utilized the epoch time a literal and a counter to get an ID that we were fairly confident would never repeat. Each Integration had its own counter. The counter was used to break ties at the epcoh time since it is only to a second and we all know we can receive and deliiver multiple messages per second.

                While there are a lot of potential uses for the Control ID, the primary use I see is to tie acknowledgtments and messages together. However, most vendors don’t know how to properly use the Control ID in Acknowledgments so that value is rather spotty.

                At first blush the MsgID would seem to fit the bill. But if you are multiple site the potential is there that messages originating in diferent sites would have the same last octet. Since the beginning octets are always zero unless using the new cross-site routing cpapability (and then the changing octet is not reliable) there is no assurance of absolute uniquentess.

                For the system I spoke of an additional negativefor the MID is it will repeat at some time (albeit a long time) even if single site and remember the receiving system indicated the Control ID could NEVER repeat EVER!

                email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

              • #79549

                I almost always use a combination of the date and time down to the seconds and the cloverleaf message id.

                Using an xlate proc (xltp) …

                proc xltp_set_msg_id {} {
                [code]proc xltp_set_msg_id {} {

                -- Max Drown (Infor)

              • #79550

                Here’s a code snippet for getting the Cloverleaf message ID in a TPS tcl proc.

                Code:

                # Get the message ID
                set midList [msgmetaget $mh MID]
                keylget midList NUM msgId

                -- Max Drown (Infor)

              • #79551
                Peter Heggie
                Participant

                  You can create a guid or uuid using this code:

                  Code:

                  package require uuid
                  set guid [::uuid::uuid generate]

                  Looking at the discussion on the tcl wiki <a href="http://www2.tcl.tk/10871&#8243; class=”bbcode_url”>http://www2.tcl.tk/10871, it appears that under certain conditions there could be a time delay because part of the value is obtained through a socket call.

                  On my AIX server, it takes about 260 milliseconds.

                  According to the IETF draft:

                  Quote:

                  A UUID

                   is 128 bits long, and if generated according to the one of the

                   mechanisms in this document, is either guaranteed to be different

                   from all other UUIDs/GUIDs generated until 3400 A.D. or extremely

                   likely to be different (depending on the mechanism chosen).

                  Peter Heggie
                  PeterHeggie@crouse.org

                • #79552
                  Jim Kosloskey
                  Participant

                    However you generate your Control ID just be cognizant that until Version 3.6 – sorry I meant 2.6 of HL/7 there is a 20 character field length on the Control ID.

                    While you can easily change that length in Cloverleaf some receiving systems actually are sensitive to that length.

                    email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

                  • #79553
                    James Cobane
                    Participant

                      If we are sending to a system receiving data from multiple sources, we will typically prefix the Control ID with a value/mnemonic representing the source system, along with a 10-digit counter value.  This will insure uniqueness across systems.  i.e.

                      INV0000456865

                      EPC0000342456

                      Jim Cobane

                      Henry Ford Health

                  Viewing 7 reply threads
                  • The forum ‘Cloverleaf’ is closed to new topics and replies.