189616968 bytes may be simply too much... The normal ("original") mode of operation in HL7 is to send one message, receive the response, send the next message, receive the next response and so on. Much like HTTP, however, instead of defining the length of a request somewhere, MLLP delimits a request by the marker bytes you mentioned. HL7 does not define a streaming mode, so neither the camel-hl7 component nor HAPI do support it.
cheers Christian 2013/1/25 StanZ <stanley....@eagleriversolutions.com>: > I'm getting the exception below when using the HL7 component and codec > with mina to receive streamed HL7 messages. The program works find when > I send it separate messages from a 2nd program using Camel/HL7/Mina and > receives an ACK successfully. But when testing with our client we're seeing > this exception. > > The HL7 hex appears to be valid when I reviewed it. It contains the special > characters for MLLP in the message: > 0x0b (11 decimal) = start marker > 0x0d (13 decimal = the \r char) = segment terminators > 0x1c (28 decimal) = end 1 marker > 0x0d (13 decimal) = end 2 marker > > Do I need to set a decoderMaxLineLength like the textline codec? Or am I'm > missing something else? The only difference I can think of is the client > test > includes the special characters listed above. And it may be a continuous > stream > instead of separate messages like my own test program sent successfully. > Appreciate any help to resolve this issue. > > 2013-01-25 18:52:08,831 WARN Camel (camel-1) thread #124 - MinaThreadPool > org.apache.camel.component.mina.MinaConsumer$ReceiveHandler - > [/209.149.112.25:7899] EXCEPTION: > org.apache.mina.filter.codec.ProtocolDecoderException: > org.apache.mina.common.BufferDataException: dataLength: 189616968 (Hexdump: > 0B 4D 53 48 <...HL7 HEX REMOVED FOR BREVITY...> 0D 1C 0D) > at > org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:165) > at > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) > at > org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) > at > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) > at > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageReceived(AbstractIoFilterChain.java:499) > at > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) > at > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageReceived(AbstractIoFilterChain.java:293) > at > org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:228) > at > org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198) > at > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45) > at > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485) > at > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) > at java.lang.Thread.run(Thread.java:722) > Caused by: org.apache.mina.common.BufferDataException: dataLength: 189616968 > at > org.apache.mina.common.ByteBuffer.prefixedDataAvailable(ByteBuffer.java:1631) > at > org.apache.mina.filter.codec.serialization.ObjectSerializationDecoder.doDecode(ObjectSerializationDecoder.java:88) > at > org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:133) > at > org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:158) > ... 14 more > 2013-01-25 18:52:08,832 DEBUG Camel (camel-1) thread #124 - MinaThreadPool > org.apache.camel.component.mina.MinaConsumer - Closing session as an > exception was thrown from MINA > 2013-01-25 18:52:08,832 INFO Camel (camel-1) thread #124 - MinaThreadPool > org.apache.camel.component.mina.MinaConsumer$ReceiveHandler - > [/209.149.112.25:7899] CLOSE > > > Maven dependencies and version: > camel-core 2.10.3 > camel-hl7 2.10.3 > camel-mina 2.10.3 > camel-jms 2.10.3 > camel-spring 2.10.3 > activemq-camel 5.7.0 > activemq-pool 5.7.0 > xbean-spring 3.12 > hapi-structures-v24 1.2 > slf4j-log4j12 1.6.6 > > CAMEL ROUTE: > // create CamelContext with HL7 codec registered > SimpleRegistry registry = new SimpleRegistry(); > registry.put("hl7codec", new HL7MLLPCodec()); > CamelContext inContext = new DefaultCamelContext(registry); > > // set up activemq jms > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); > // add jms queue to camel context > inContext.addComponent("hl7-jms", > JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); > > // add our route to the CamelContext > try > { > inContext.addRoutes(new RouteBuilder() > { > public void configure() > { > getContext().setHandleFault(true); > onException(Exception.class).continued(true); > // route from mina endpoint to jms component > from("mina:tcp://" + hl7Ip + ":" + hl7Port + > "?sync=true&minaLogger=" + > minaLogger) > .to("hl7-jms:queue:hl7"); > > // route from jms component to hl7 message handling bean > from("hl7-jms:queue:hl7") > .unmarshal() > .hl7(true) > // route based on HL7 version to > HL7BusinessLogic endpoint to transform > the HL7 message object > .choice() > > .when(header("CamelHL7VersionId").isEqualTo("2.4")) > > .to("bean:com.eagleriversolutions.app.erspoc.hl7v2.ProcessHl7V24Message?method=transformHl7Message") > .end() > // send ACK/ NAK to HL7 sender > .marshal() > .hl7(true); > } > }); > > // start the route and let it do its work > inContext.start(); > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HL7-Mina-throwing-org-apache-mina-filter-codec-ProtocolDecoderException-org-apache-mina-common-Buffen-tp5726292.html > Sent from the Camel - Users mailing list archive at Nabble.com.