문제

I am passing java object from JMS sender client to mirth.Java Class look like this:

public class OrderDetails implements Serializable{

    private static final long serialVersionUID = -4617153110762983450L;
    private Long mrn;
    private Long orderNo;
    private Long patientId;
    private Long orderId;
    private Long encounterId;

}

JMS client code looks like this:

public void sendMessage(final OrderDetails orderDetails) throws JMSException {
        LOG.debug("Starting sendMessage of AMQMsgSenderService");
        jmsTemplate.send(new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                LOG.info("SENDING: " + orderDetails);
                ObjectMessage message = session.createObjectMessage( orderDetails );
                return message;
            }
        });
        LOG.debug("Ending sendMessage of AMQMsgSenderService");
    }

Connector Type in Mirth is JMS Reader. I want to receive java object in source and transform into XML or JavaScript Object. Is it possible in Mirth?I am using Mirth Version 2.2.1.5861.

도움이 되었습니까?

해결책

I may suggest one of possible solutions, that is tested under the Mirth Connect v3.0. I’m hoping it should work under the v2.2 as well. Basically, you are moving on in the right direction, possible steps to complete are:

  • On the JMS Sender side, create an instance of the object and populate required fields;
  • Serialize the object (using org.apache.commons.lang3.SerializationUtils.serialize for example);
  • Then encode the result (using the Mirth built-in Base64 encoder);
  • Pass this to the destination connector which is configured as the JMS Sender.

On the receiver side do the same in a reverse order:

  • Decode the received raw message (Base64 decoder);
  • Deserialize the byte array into the object (using the org.apache.commons.lang3.SerializationUtils.deserialize);
  • Access object’s fields.

Hope this helps.

(Ps. All steps described above in detail, with screenshots and code snippets, for a case where both sender and receiver are Mirth channels, are given in the “Unofficial Mirth Connect developer’s guide”. Disclaimer: I’m the author of this book so any comments or suggestions are welcome.)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top