Announcement

Collapse
No announcement yet.

JMS Listener receiving java object problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMS Listener receiving java object problem

    Hi All,

    I have searched this forum but unable to find an answer for my problem.

    Mirth version : 3.0.1.7051

    Problem : Object received by JMS Listener in Mirth unable to find it's functions and properties.

    For POC purpose to show demo to our client, i have created a JMS topic publisher client(activemq) which sends out an Object Message which is received by JMS listener in mirth. The class of the object which is being sent has it's own toString method, where it builds a string having all its fields.
    I am able to receive the message sent by jms in mirth. In channel preprocessor step i am printing the incoming message.

    Code:
    logger.debug('Recived Message : ' + message);
    I think it is printing contents build by toString method. Further in filter step when i am trying to access getter methods of that object i am getting error.
    Also i have packed all the classes in the jar file and placed it in mirth custom lib.

    Code:
    DETAILS:	TypeError: Cannot find function getFacility in object com.xxxxxx.xxxxxxxx.xxxxx.UpdatexxxxxxxMessage:
      facility: Demo
      patient: 
        accountNumber: empty
        firstName: xxxxxx
        lastName: TExxSxxxxxT-xxxxx
        middleName: empty
        gender: M
        allergies: [com.xxxxx.xxxx.xxxxxxx.AllergenInformation:
      allergenCode: NKA
      allergenName: NKA
      allergenString: NKA
      order: 
        suppressOrderVersioning: false
        isDCMessage: false
        isCPOE: false
        orderComponents: [com.xxxxxx.ixxfxxxxxxx.xxxxx.OrderComponentInformation:
      med: 
        isValid: false
        barcode: empty
        ndc: empty
        strength: 100.0
        strengthUnits: Units
        volume: 1.0
        volumeUnits: mL
        dosageForm: Injection
        chargeCode: 25664248:2280403
        medClass: U
        dispenseSize: 10.0
        dispenseUnits: mL
        referenceBrandName: empty
        MultiDose: empty
        remindersDisabled: empty
        packagedDrug: empty
        showRouteWarning: empty
        excludeFromAllergyCheck: empty
        excludeFromDrugInteractionCheck: empty
        strengthDescriptor: empty
        availableDosingAmount: 1000.0
        dosingUnit: Units
        ivBaseSolution: false
        brandName: empty
        billable: true
        rtUnorderedOk: empty
        rxUnverifiedOk: empty
        alternateCpoeMedId: empty
      additiveBaseFlag: empty
      amount: 10.0
      units: 
    ]
    BLOOD SUGAR         INSULIN DOSE
    < 70                    HYPOGLY PROTOCOL
    130 - 150              2 UNITS 
    151 - 170              3 UNITS
    171 - 190              4 UNITS
    191 - 210              5 UNITS
    211 - 230              6 UNITS
    231 - 250              7 UNITS
    251 - 270              8 UNITS
    271 - 300              9 UNITS
    301 - 349             10 UNITS
    >= 350                CALL PHYSICIAN]
        customDosingTimes: empty[]
        barcode: xxxxx
        discontinuedDateTime: null
        holdDateTime: null
        holdReleaseDateTime: empty
        doseAmount: null
        doseUnits: null
        effectiveDateTime: Sat Apr 27 22:38:03 IST 2013
        giveAmountMax: 10.0
        giveAmountMin: 2.0
        giveUnits: UNITS
        numberOfDosesAllowed: null
        rate: null
        rateUnits: null
        routeCode: SUBCUT
        sigCodeType: PRN
        stopDateTime: null
        administrationMethod: Med
        pharmacistId: empty
        orderCancelled: empty
        physicianOrderDetail: empty
      admin: 
        prompts: 
        user: 
          loginName: rntest
          firstName: RN
          lastName: Test2
          barcode: T22345
          initials: test2
        id: 183
        dueTime: null
            user: 
              loginName: xxxxxx
              firstName: xxxxxx
              lastName: xxxxxx
              barcode: xxxxxxxxx
              initials: test2
            answerEvents: 
              
                executionStatus: Confirmed
                occurredDateTime: Sat Apr 27 23:30:34 IST 2013
                autodocumented: false
                value: 
                  clinicalType: Injection Site
                  value: 
                    nestedValues: 
                      
                        dataType: Response List
                        value: 
                          name: Injection Site
                          units: null
                          value: null
                          nestedValues: 
                            
                              name: name
                              units: null
                              value: xxxxxxxx
                              nestedValues: 
                              annotation: null
                              overrideReason: null
                              normalRange: null
                              abnormalFlag: null
                              outboundingCode: null
                          annotation: null
                          overrideReason: null
                          normalRange: null
                          abnormalFlag: null
                          outboundingCode: SITE
                    annotation: null
                    overrideReason: null
                    normalRange: null
                    abnormalFlag: null
                    outboundingCode: SITE
                clinicalState: Normal
                auditLogId: 497
      temporaryOrderNumber: null
      temporaryOrderStartTime: null
    .
    	at 0d1ddacd-b615-441e-945d-0a95a9075244:1575 (filterRule1)
    	at 0d1ddacd-b615-441e-945d-0a95a9075244:1604 (doFilter)
    	at 0d1ddacd-b615-441e-945d-0a95a9075244:2335 (doScript)
    	at 0d1ddacd-b615-441e-945d-0a95a9075244:2337
    	at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.call(JavaScriptFilterTransformer.java:134)
    	at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.call(JavaScriptFilterTransformer.java:100)
    	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    	at java.util.concurrent.FutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)

    Edit:
    After looking at Mirth source code(jms receiver), noticed that message received by JMS listener is converted to raw message which is simply calling toString() for the object it receives. Is there anyway to process actual object in Mirth from JMS listener???
    Last edited by sibmat; 05-09-2014, 05:32 AM. Reason: Update question.

  • #2
    Once the message is dispatched to the channel, it's just a String, nothing more. However, if you re-serialize it back into the object you want, then you can use those methods (you'll also have to include the necessary classes on the classpath by including the associated JARs in custom-lib).

    Is there a way to re-serialize that toString() representation? If not, you may want to change toString() to something that can be re-serialized.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      We've created an issue on our roadmap to better handle JMS ObjectMessages and other JMS message types in the future:

      http://www.mirthcorp.com/community/i...wse/MIRTH-3183

      Comment


      • #4
        Originally posted by narupley View Post
        Once the message is dispatched to the channel, it's just a String, nothing more. However, if you re-serialize it back into the object you want, then you can use those methods (you'll also have to include the necessary classes on the classpath by including the associated JARs in custom-lib).

        Is there a way to re-serialize that toString() representation? If not, you may want to change toString() to something that can be re-serialized.
        Thank you very much for the prompt reply.
        we have recommended them to send xml representation of the object instead of object itself, so in mirth we can unmarshall it back to object and use it.
        Also will tel them Serialize and de serialize option using toString() method.

        Comment


        • #5
          Is it possible to create a custom JMS receiver to pick actual object from activemq. They will not modify their existing interface to send xml instead of object to activemq. If it is possible to create separate JMS receiver and integrate with mirth some guidance will be very helpful.

          Comment


          • #6
            Replace Default JMS connector with custom connector.

            I downloaded the Mirth Source code. Modified the JMS receiver class and other dependent class to receive serialized object and encoded it to base64 format string and dispatch it to channel as RawMessage(b64encode).

            Pack the modified JMS connector classes to jar files (jms-client,jms-server,jms-shared), sign the jars with provided keystore and replace \Mirth Connect\extensions\jms\ jars with new jars, edit source.xm and destination.xml files.

            It seems to work, after i receive base64 encoded string in my channel, decoded then deserialize to object and use it.

            Will i face any problems in this approach??..also if use these jars in other environments do i need to resign it again.

            Thank you.

            Comment

            Working...
            X