reply through TCL

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf reply through TCL

  • Creator
    Topic
  • #50529
    Brahim AlHawwas
    Participant

      Dear All,

      I have a situation where I am supposed to get an HL7 message and write it down to a DB. I have done a middle step where I move the information to an HRL. So I have three threads where one reads, second gets HRL and the third writes to DB. I wanted to make sure that whenever the DB changes or The credential does the connection hangs or stops. I have thought about stopping the thread through TCL after trying to connect but this is not efficient as the message would go to Error DB so it would not be processed when the thread starts again.

      I wanted to have the message in the recovery, so I thought about asking for HL7 reply for the original message. I have passed the MSH segment through HRL and tried to generate the reply but could not. I get a message that you have not disposition the original message.

      In general I have three threads A,B and C

      A reads the message and send it to B through TCP and waits for replies from B.

      B gets the message into HRL and send it to C.

      C writes down these info to DB and tries to generate reply.

      B forwards C reply to A.

      I am stuck with the reply issue.

      Any thoughts or comments!!!!

    Viewing 4 reply threads
    • Author
      Replies
      • #66484
        Anonymous
        Participant

          Can you give us more information on the protocol and method on thread C. There are several things I’m thinking you can do but I need more information on how the data gets into the database and how the reply should get back to you.

        • #66485
          Brahim AlHawwas
          Participant

            Hi John,

            Thank you for your reply.

            To clarify the issue, I am dealing with Oracle functions so I can get back a string as a reply from Oracle. I have a TCL function on my script that I am calling validateReply that would analyze the reply. If the reply is accepted try to to generate a reply to thread A passing through thread B. This to inform A that I have succeeded calling the function and I am ready for the next message.  I am not doing a reply for B because it is HRL which is not the original message in which I am afraid to lose some info when failure occurs on XLT.

            Another thing is I am having if else where the condition is connected. In this situation I am shutting down the thread through “exec hcicmd -p processA -c “dbhandler pstop” “when the proc can not connect to DB. I want to send back a reply to A from C telling it I have failed keep the message in Recovery DB. This should follow the same concept of previous one.

            I am also worried about when having multiple sites. This is because in TCL I could not execute” exec setsite mySite”. It does not complain but it does not take any effect. I have one site in production so It is not big deal for now. Would be brilliant if you know work around.

          • #66486
            Brahim AlHawwas
            Participant

              Silly Mistake as usual.

              The issue regarding “exec setsite Mysite” is not important at all as the script is already invoked from within a site.

              Sorry for that.

            • #66487
              Jim Kosloskey
              Participant

                Brahim,

                Is it really necessary to use end-to-end acknowledgment (that is A has to wait until C acknowledges) or can you acknowledge A upon receipt of the message from A? Then if C has a problem, email and/or page the responsible party for A and do whateverf actions are necessary.

                One thing you should make sure is that the thread that is invoking the ODBC Drivers is in a different process than other threads because while trying to make sure you get connected (and perhaps other SQL activity) you are probably issuing a sleep. That sleep sleeps the entire process which will affect every thread in the process.

                We only have one ODBC integration in Production, another in test, and yet another in development so we are not experts by any means.

                What we do here is acknowledge A upon receipt of message; deliver to another process; in that process, 3 threads B which receives the original message.; Xlate to VRL or HRL or XML; C (TCP/IP protocol) with acknowledgment handling in place – C points to localhost some port; and D which listens on localhost same port as C and does the ODBC calls and returns an appropriate acknowledgment to C where normal ack/nak handling occurs.

                So A sends a message, receives an acknowledgment, sends another message, etc. A never receives an acknowledgment from the final destination.

                If something goes wrong on the Database connection, a nak is generated (D does that) and normal acknowledgment handling for naks occurs in C and the appropriat parties are notified, threaqds stopped, etc.

                For the acknowledgment from D we use a VRL ack message and have a generic reply handling proc (for C) that can have any Cloverfleaf(R) supported message type for a reply and interrogate multiple fields with multiple conditions and operators to logically determine the receipt of acks and naks (or just other message); and take appropriate action(s).

                email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

              • #66488
                Brahim AlHawwas
                Participant

                  Hi John,

                  Thank you for your reply.

                  It is not necessary at all to have the long trip pf reply. I mean from C to D. I am for sure going to have the principle of multiple processes as I have been already directed to do so. You told me that you do the ACK in D thread of your case and it sends it through TCPIP to C which handles the ACK. The main point for me is this:

                  I have tried to generate HL7 reply from within TCL but it keeps yelling that “could not write message in TPS wire” error. So my problem does not seem to be the reply format or so but sending it. Other error is when I do disposition for the original mesage like set disp ” {CONTINUE $mh} {OVER $reply}”, this would complain that original message has not been handled while it is the mh var. So it basically fails to read the disposition.

                  I was and still quite hesitant towards having VRL reply as I have not ever seen one and it is very hard to me to do. I want the Control ID of the message in the VRL and thats as far as I know is enough. Could you tell me please how did you configure C, D -in your case- to receive, send VRL replies. If possible can you share the code you have or at least the algorithm of it.

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