Integrating Apache Active Message Queue(AMQ) with BizTalk Server – Publishing messages Part 2 (extra linefeed)

Posted: February 23, 2017  |  Categories: BizTalk Uncategorized
Tags: AMQ REST

In previous blog I wrote about publishing a message to a AMQ. The documentation says “ActiveMQ implements a RESTful API to messaging which allows any web capable device to publish or consume messages using a regular HTTP POST or GET.”. In this article I want to share an issue that we have not been able to solve. A HTTP POST of a string “blah” to an Apache AMQ in our hands always adds an extra linefeed character i.e. “blahLF”.

We posted a positional flat file to an AMQ as shown below that does not contain any end of line(EOL) character.

clip_image002

We also used fiddler to confirm that the payload did not have a EOL character. The capture is shown below;

POST http://server01d:8161/api/message/MISC.MAX.DATA?type=queue&clientId=misc_data_biztalk&message_type=7228&message_version=1&branch_number=0&message_length=1268 HTTP/1.1
Content-Type: text/plain; charset=utf-8
Authorization: Basic bRlzY19kYXnotRealRhbGs6cUFUMUpLQ2dZUQ==
User-Agent: Microsoft (R) BizTalk (R) Server 2013 R2
Host: server01d:8161
Content-Length: 1268
Expect: 100-continue
Connection: Keep-Alive

T201701160700102017011620001020170116NTheGarbageseEftpos              NTWLPalmerstonNorth              NPN19.25     N1 Y                                                                Y            NNZDN483741……28  N0317N0317                            NL A/ARAVENA ARAVENA                                                                                                             000000032d028299NTXN100717                                                                       N00N00      NAPPROVED                                Y                N0000030170532858N9030200048573514    Y                                                                Y                                                                Y                                                                Y                                NSCR200          NPXULETSL_LIVE                   N895038         N89503801N4640      N146XA                           N4020618221          N0 NUnknown   NJY                                Y  YNZN281       Y                                                                Y                                Y                                N483741    NContactEMV                      N250       N3028      N755139225           N20170116NBEAEA6171CE0C6FF

When we retrieve the message from the queue using a HTTP GET or programmatically using STOMP we always get a line feed as an EOL character as shown below.

image

We believe it is the Apache REST API that is adding the additional LF character. Is this normal behaviour for the Apache AMQ REST API? We do not know how the REST API is implemented but if it is using the STOMP protocol it may be normal to add a line feed character. I’m wondering if the STOMP Frame is adding the LF.  I don’t know enough about the ActiveMQ to know for sure. See https://svn.apache.org/repos/asf/activemq/stomp/trunk/webgen/src/stomp10/specification.page which says;

We will use the augmented Backus-Naur Form (BNF) used in the HTTP/1.1 (rfc2616) to define a valid stomp frame:

LF                  =
CHAR                =
OCTET               =
DIGIT               =
NULL                =

frame-stream        = 1*frame

frame               = command LF
*( header LF )
LF
[ content ]
NULL
*( LF )


                          *( header LF )
                          LF
                          [ content ]
                          NULL
                          *( LF )

In summary we have found that the if we use Apache REST API to POST a message to a AMQ an extra line feed character is appended to the message. Does anyone know whether this is normal behaviour or is there a way to suppress this happening?

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top