How to create HL7 ACK messages in nHAPI - nhapi

I have created an HL7 response message(ADR_19) by using nHAPI in C#.
How can I add an ACK message in the response HL7 message?

You can do this by using the terser supplied by nHapi. A while ago I've posted an example for using the terser to create an Ack message:
http://www.dib0.nl/code/63-creating-a-hl7-acknack-message-in-net-using-nhapi
Good luck!

Related

Request/reply with rest

I'm unable to implement request/reply pattern using rest protocol with solace.
I'm correctly receiving a request and I can see some headers like "solace-correlation-id" and "solace-message-id".
What I'm expecting is to return an http response with the body as message reply but I always get in my application:
org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 20000 millis due reply message with correlationID: xxxxx-1549904557890-0-26 not received on destination: #P2P/QTMP/v:cfdce68771f5/c9c4ba4a-a427-438a-9b7a-1f069608d13a.
Unfortunately the solace documentation only covers pub/sub pattern for rest but not the request/reply one.
There could be a few different things going on here.
Firstly try adding the log component between the "from" and "to" endpoints and again after the "to" endpoint as this will show you the headers of the reply, for example, using the Java DSL syntax:
from("{{fromSource}}" )
.to("log:all?level=INFO&showAll=true&multiline=true")
.to("{{toDest}}" )
.to("log:all?level=INFO&showAll=true&multiline=true")
;
I suspect the correlation id is not getting passed back. In my example I have a a NodeJS service so I set the following response header:
res.setHeader('solace-correlation-id', req.get('solace-correlation-id'));
With the additional logging, you should be able to see what is going wrong.
You are most likely missing the message ID or coorelation ID in your reply message.
https://docs.solace.com/RESTMessagingPrtl/Solace-REST-Message-Encoding.htm#2.2.6.1
When the Solace message broker receives a possible reply message routed to the HTTP client, it verifies that the reply message's message ID or correlation ID match those of the request message.
Specifically,
- the reply's message ID must match the request's message ID the
- reply's correlation ID must match the request's message ID, or the
- reply's correlation ID must match the request's correlation ID.
If any of those matches occur, the Solace message broker sends the reply message as an HTTP response to the HTTP client.
HTTP requires that there be exactly one HTTP response for each HTTP request, so each matching message ID or correlation ID can be used only in a single request-reply message exchange pattern.
If the reply message does not have a matching message ID or correlation ID as above, or if the reply message's matching message ID or correlation ID has already been consumed by an earlier reply message, the reply message is discarded.

Error publishing python dict to Solace using AMQP/qpid-proton

Trying to run producer.py from solace-samples-amqp-qpid-proton-python with payload of python dict
Message(id=(self.sent+1), body={'sequence':(self.sent+1)})
Get following error
Reject message: 1 Remote disposition:
Condition('amqp:not-implemented', 'unsupported AMQP value type:
TOK_MAP_START')
Get similar error when trying to send integer value in body - TOK_TYPE_INT
Does solace support only Strings over AMQP?
Solace message brokers support amqp-value message sections containing values of types null, string, binary, symbol, or uuid. (https://docs.solace.com/Open-APIs-Protocols/AMQP/AMQP-Protocol-Conformance.htm#Sec3-2-8)
This is done in order to preserve maximum message inter-operability.
Any published message using a language specific semantic can only be consumed using the same semantic. I.e. if you publish with Python dict, you can only decode using Python dict, so if you are using a MQTT or REST consumer, it will not be able to decode the message.
The best option is to use a cross-language serialization library, which will make it easier for future expansions. For example, you might decide to add an REST consumer to in future, which can decode the data using the cross-language serialization library.

Content-Type alternative in MQTT

I am Working on MQTT communication using Paho and Mosqitto. We have to support both model of serialization - xml and json. So I am looking How to identify the content type or payload type in MQTT. Is there something similar HTTP Content-Type in MQTT to identify it quickly ?
Content-Type : application/json
Content-Type : application/xml
Thanks
No, MQTT payloads are just byte arrays and there is no space in the headers (because MQTT is designed to be as light weight as possible on the network). Anything else is down to the application to implement with in the payload.
You could use multiple topics to show the difference.
e.g. foo/bar/xml or foo/bar/json and subscribe to foo/bar/+ which will match both and then switch based on the topic.
or just test the first char of the payload, '{' = json '<' = xml
2021 answer
MQTT 5.0 introduced the concept of Properties. Basically, properties are UTF-8 string key-value pairs that you can add to an MQTT packet. The new specification also defines payload-format and content-type to convey information about the MIME type contained in the payload. So in principle, you can use this property in your application much like in HTTP you use Content-Type header.

How to decode an XMPP message in Erlang with ejabberd?

I am using ejabberd 14.07.
When I send a space character in a message, it is replaced by the "+" symbol.
What do I need to do to decode the message, for example message = "Hi test" means it will receive "Hi+test".
How to solve this problem ?
This is not related to ejabberd. ejabberd XMPP client (c2s) or server (s2s) connection does not replace space with + symbol. It looks like you have a web tool injecting content into ejabberd and that it does not decode its input properly.

Mirth Connect HTTP Listener Mapping Response ACK message

We are trying to merge two Mirth servers. One server (let's call it Server 1) is keeping all records and another server (Server 2) is getting HL7 message from the first one and writes messages to the database.
Everything was perfect so far. But Server 1, after sending each HL7 message, waits for ACK to consider this transaction as completed and to send another message from the list.
The success status coming from the Server 2 (which writes to the database) contains MySQL response such as "Success: Database write success. 1 rows updated.". This is not what Server 1 is expecting.
Therefore, the Server 1 considers this ACK as invalid, produces an error "Message Read Error - Will Retry" and keeps trying to send the same message again, causing Server 2 to duplicate messages in the database.
We are using Mirth Connect HTTP listener and we could not find any solution to send ACK msg to our first server the same screen HTTP listener.
Is there any way to do this? Any Suggestion?
Really need help.
The problem is you are not setting the response from server 2 correctly, so it just returns what the destination has. You can create an ACK by code on the destination transformer:
var ackMessage = ACKGenerator.generateAckResponse(connectorMessage.getRawData(), "AA", "Message Successfully Received");
responseMap.put("ackresp", ResponseFactory.getSentResponse(ackMessage));
And on your source connector select "ackresp" as response. Your server 1 will receive that ACK instead of the log of the database write.

Resources