You should probably apply some kind of a content transformation to transform this payload into a XML payload with multiple "text" elements (one per each syslog message). But I'm not sure whether traditional techniques like XSLT and XQuery support that kind of transformations. After all you're trying to transform based on XML text and not the XML nodes. That's almost always very difficult.
IMO you're better off writing a custom mediator to do this transformation. Then you can use the iterate mediator to split the message into its constituents and send to the JMS queue. An even more elegant solution would be to write a custom message builder that knows how to parse the incoming batch requests and construct a proper XML payload out of it. Thanks, Hiranya On Jul 26, 2013, at 6:10 AM, "Wright, Peter" <[email protected]> wrote: > Hi, > > I got synapse working with a TCP-Listener accepting plain text messages > as input, and the messages being sent as JMS messages to IBM Websphere MQ. > > Now we're in the test phase with "real" syslog (RFC-5424) data, and I'm > having a problem > because the TCP listener is receiving multiple syslog messages in one TCP > message. > The multiple messages are being sent on as one JMS message. The individual > syslog messages are separated by NL and have the message length at the start. > > Here an example message from my log file with 8 syslog messages: > > 2013-07-25T16:12:20,INFO ,mdzhsfesb01,MSGMED,MediatorLog.java:99,To: , > WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: > urn:uuid:1BC21F33F4BAA449111374761227027, Direction: request, Envelope: > <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><text > xmlns="http://ws.apache.org/commons/ns/payload"> > 186 <174>1 2013-07-25T16:08:00+02:00 mdzhldos02 DaMon.DAWD 12355 - [meta > sequenceId="1"] [HEARTBEAT@7410 Type="Heartbeat" timestamp="1374761220" > telegrams="5522922" BKs="632" LineIDs="441"] > 400 <170>1 2013-07-25T16:09:00+02:00 mdzhldos02 DaMon.DAWD 12355 - [meta > sequenceId="2"] [Ticket_605@7410 Type="Feed Outage" Status="New" BC="462" > BK="842" Occured="1374760680" Reported="1374761340" Summary="Outage of BC 462 > at 2013-07-25 13:58:00 UTC (DAWD on mdzhldos02)" Details="Outage of BC 462; > BK 842; No Bid/Asks for 11 minutes; Occured: 2013-07-25 13:58:00 UTC; > Reported by DAWD on mdzhldos02"] > 186 <174>1 2013-07-25T16:09:00+02:00 mdzhldos02 DaMon.DAWD 12355 - [meta > sequenceId="3"] [HEARTBEAT@7410 Type="Heartbeat" timestamp="1374761280" > telegrams="6001019" BKs="665" LineIDs="441"] > 186 <174>1 2013-07-25T16:10:00+02:00 mdzhldos02 DaMon.DAWD 12355 - [meta > sequenceId="4"] [HEARTBEAT@7410 Type="Heartbeat" timestamp="1374761340" > telegrams="4908793" BKs="612" LineIDs="440"] > 119 <174>1 2013-07-25T16:10:40+02:00 mdzhldos02 DaMon.DAWD 24438 - [meta > sequenceId="5"] [HEARTBEAT@7410 type="Heartbeat"] > 362 <170>1 2013-07-25T16:11:00+02:00 mdzhldos02 DaMon.DAWD 12355 - [meta > sequenceId="6"] [Ticket_605@7410 Status="Close" BC="462" BK="(null)" > Occured="1374761340" Reported="1374761460" Summary="Problem with BC 462 > disappeared at 2013-07-25 14:09:00 UTC (DAWD on mdzhldos02)" Details="Problem > with BC 462 disappeared at 2013-07-25 14:09:00 UTC (DAWD on mdzhldos02)"] > 186 <174>1 2013-07-25T16:11:00+02:00 mdzhldos02 DaMon.DAWD 12355 - [meta > sequenceId="7"] [HEARTBEAT@7410 Type="Heartbeat" timestamp="1374761400" > telegrams="6099578" BKs="657" LineIDs="440"] > 186 <174>1 2013-07-25T16:12:00+02:00 mdzhldos02 DaMon.DAWD 12355 - [meta > sequenceId="8"] [HEARTBEAT@7410 Type="Heartbeat" timestamp="1374761460" > telegrams="5570590" BKs="613" LineIDs="446"] > </text></soapenv:Body></soapenv:Envelope> > > What is the recommended way of handling this? Use the Iterate-Mediator to > split the messages and send them individually? Do I have to use Xpath here, > or is it possible to use e.g. javascript? Any examples would be appreciated. > > Thanks for any help, > Peter > > > The content of this e-mail is intended only for the confidential use of the > person addressed. > If you are not the intended recipient, please notify the sender and delete > this email immediately. > Thank you. -- Hiranya Jayathilaka Mayhem Lab/RACE Lab; Dept. of Computer Science, UCSB; http://cs.ucsb.edu E-mail: [email protected]; Mobile: +1 (805) 895-7443 Blog: http://techfeast-hiranya.blogspot.com
