Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mllp #256

Open
mpetavy opened this issue Jan 31, 2019 · 2 comments
Open

mllp #256

mpetavy opened this issue Jan 31, 2019 · 2 comments
Labels

Comments

@mpetavy
Copy link

mpetavy commented Jan 31, 2019

I try to run the HL7 tutorial sample with a TCP Mllp endpoint as source.
Modified SampleRouteBuilder.groovy

        from("mina2:tcp://localhost:7000?sync=true")
//        from('file:target/input')
                .convertBodyTo(String)
                .to('direct:input')

Modified pom.xml: Add dependency for MLLP

<dependency>
  <groupId>org.openehealth.ipf.platform-camel</groupId>
  <artifactId>ipf-platform-camel-ihe-mllp</artifactId>
</dependency>

When I try to send the provided ipf\tutorials\hl7\src\test\resources\msg-01.hl7 HL7 message to the configured endpoint I get an exception (see below).

What is wrong?
Thanks.

15:19:35.329 [NioProcessor-3] DEBUG org.apache.mina.filter.executor.OrderedThreadPoolExecutor - Adding event SESSION_OPENED to session 2
Queue : [SESSION_OPENED, ]

15:19:35.334 [NioProcessor-3] DEBUG org.apache.mina.filter.codec.ProtocolCodecFilter - Processing a MESSAGE_RECEIVED for session 2
15:19:35.335 [pool-4-thread-1] DEBUG org.apache.mina.core.filterchain.IoFilterEvent - Firing a SESSION_OPENED event for session 2
15:19:35.340 [NioProcessor-3] DEBUG org.apache.mina.filter.executor.OrderedThreadPoolExecutor - Adding event EXCEPTION_CAUGHT to session 2
Queue : [EXCEPTION_CAUGHT, ]

15:19:35.342 [pool-4-thread-1] DEBUG org.apache.mina.core.filterchain.IoFilterEvent - Event SESSION_OPENED has been fired for session 2
15:19:35.345 [pool-4-thread-1] DEBUG org.apache.mina.core.filterchain.IoFilterEvent - Firing a EXCEPTION_CAUGHT event for session 2
15:19:35.346 [pool-4-thread-1] WARN  org.apache.camel.component.mina2.Mina2Consumer - Closing session as an exception was thrown from MINA
15:19:35.349 [NioProcessor-3] DEBUG org.apache.mina.filter.executor.OrderedThreadPoolExecutor - Adding event SESSION_CLOSED to session 2
Queue : [SESSION_CLOSED, ]

15:19:35.348 [pool-4-thread-1] WARN  org.apache.mina.core.filterchain.DefaultIoFilterChain - Unexpected exception from exceptionCaught handler.
org.apache.camel.CamelException: org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.mina.core.buffer.BufferDataException: dataLength: 189616968 (Hexdump: 0B 4D 53 48 7C 5E 7E 5C 26 7C 53 41 50 2D 49 53 48 7C 48 5A 4C 7C 7C 7C 32 30 30 34 30 38 30 35 31 35 32 36 33 37 7C 7C 41 44 54 5E 41 30 31 7C 31 32 33 34 35 36 7C 54 7C 32 2E 32 7C 7C 7C 45 52 0D 45 56 4E 7C 41 30 31 7C 32 30 30 34 30 38 30 35 31 35 32 36 33 37 0D 50 49 44 7C 31 7C 7C 37 39 34 37 31 7C 7C 4D 65 69 65 72 5E 45 6C 66 72 69 65 64 65 7C 4D 65 69 65 72 7C 31 39 34 30 30 31 30 31 30 30 30 30 30 30 7C 46 7C 7C 7C 48 61 75 70 74 73 74 72 61 73 73 65 20 32 33 5E 5E 45 73 73 65 6E 5E 4E 57 5E 31 31 30 30 30 5E 44 45 5E 48 7C 7C 7C 7C 7C 53 7C 7C 7C 31 31 31 2D 31 31 2D 31 31 31 31 7C 7C 7C 7C 45 73 73 65 6E 0D 4E 4B 31 7C 31 7C 4D 65 69 65 72 5E 45 6C 66 72 69 65 64 65 7C 45 4D 43 7C 48 61 75 70 74 73 74 72 61 73 73 65 20 32 33 5E 5E 45 73 73 65 6E 5E 4E 57 5E 31 31 30 30 30 5E 44 45 7C 33 33 33 2D 34 34 34 34 7E 33 33 33 2D 35 35 35 35 7C 0D 50 56 31 7C 31 7C 49 7C 49 53 4B 41 5E 31 33 5E 34 7C 52 7C 7C 7C 7C 38 32 33 37 34 35 32 31 37 7C 7C 7C 7C 7C 7C 7C 7C 4E 7C 7C 7C 37 39 32 33 37 36 34 35 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 32 30 30 34 30 38 30 35 30 30 30 30 30 30 0D 1C 0D)
	at org.apache.camel.component.mina2.Mina2Consumer$ReceiveHandler.exceptionCaught(Mina2Consumer.java:389) ~[camel-mina2-2.23.0.jar:2.23.0]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.exceptionCaught(DefaultIoFilterChain.java:969) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextExceptionCaught(DefaultIoFilterChain.java:697) [mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1100(DefaultIoFilterChain.java:48) [mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.exceptionCaught(DefaultIoFilterChain.java:1096) [mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:106) [mina-core-2.0.19.jar:?]
	at org.apache.mina.core.session.IoEvent.run(IoEvent.java:88) [mina-core-2.0.19.jar:?]
	at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:761) [mina-core-2.0.19.jar:?]
	at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:753) [mina-core-2.0.19.jar:?]
	at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:692) [mina-core-2.0.19.jar:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.mina.core.buffer.BufferDataException: dataLength: 189616968 (Hexdump: 0B 4D 53 48 7C 5E 7E 5C 26 7C 53 41 50 2D 49 53 48 7C 48 5A 4C 7C 7C 7C 32 30 30 34 30 38 30 35 31 35 32 36 33 37 7C 7C 41 44 54 5E 41 30 31 7C 31 32 33 34 35 36 7C 54 7C 32 2E 32 7C 7C 7C 45 52 0D 45 56 4E 7C 41 30 31 7C 32 30 30 34 30 38 30 35 31 35 32 36 33 37 0D 50 49 44 7C 31 7C 7C 37 39 34 37 31 7C 7C 4D 65 69 65 72 5E 45 6C 66 72 69 65 64 65 7C 4D 65 69 65 72 7C 31 39 34 30 30 31 30 31 30 30 30 30 30 30 7C 46 7C 7C 7C 48 61 75 70 74 73 74 72 61 73 73 65 20 32 33 5E 5E 45 73 73 65 6E 5E 4E 57 5E 31 31 30 30 30 5E 44 45 5E 48 7C 7C 7C 7C 7C 53 7C 7C 7C 31 31 31 2D 31 31 2D 31 31 31 31 7C 7C 7C 7C 45 73 73 65 6E 0D 4E 4B 31 7C 31 7C 4D 65 69 65 72 5E 45 6C 66 72 69 65 64 65 7C 45 4D 43 7C 48 61 75 70 74 73 74 72 61 73 73 65 20 32 33 5E 5E 45 73 73 65 6E 5E 4E 57 5E 31 31 30 30 30 5E 44 45 7C 33 33 33 2D 34 34 34 34 7E 33 33 33 2D 35 35 35 35 7C 0D 50 56 31 7C 31 7C 49 7C 49 53 4B 41 5E 31 33 5E 34 7C 52 7C 7C 7C 7C 38 32 33 37 34 35 32 31 37 7C 7C 7C 7C 7C 7C 7C 7C 4E 7C 7C 7C 37 39 32 33 37 36 34 35 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 7C 32 30 30 34 30 38 30 35 30 30 30 30 30 30 0D 1C 0D)
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:262) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:641) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1114) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:121) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:641) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:634) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:539) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$1200(AbstractPollingIoProcessor.java:68) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1242) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1231) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:683) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) ~[mina-core-2.0.19.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_121]
	... 1 more
Caused by: org.apache.mina.core.buffer.BufferDataException: dataLength: 189616968
	at org.apache.mina.core.buffer.AbstractIoBuffer.prefixedDataAvailable(AbstractIoBuffer.java:2295) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.filter.codec.serialization.ObjectSerializationDecoder.doDecode(ObjectSerializationDecoder.java:93) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:180) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:253) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:641) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1114) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:121) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:641) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:634) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:539) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$1200(AbstractPollingIoProcessor.java:68) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1242) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1231) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:683) ~[mina-core-2.0.19.jar:?]
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) ~[mina-core-2.0.19.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_121]
	... 1 more

@ohr
Copy link
Member

ohr commented Jan 31, 2019

You need to define a HL7Codec for Mina, so that it knows how to unwrap the message.
It can be added to the context.xml file:

...
<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec"/>

The URI is then from("mina2:tcp://localhost:7000?sync=true&codec=#hl7codec")

@mpetavy
Copy link
Author

mpetavy commented Jan 31, 2019

Thanks for the reply.

But the hl7codec is already recognized,
I see in the log the following line:

23:44:54,268 [main] DEBUG - DefaultSingletonBeanRegistry.getSingleton(213) | Creating shared instance of singleton bean 'hl7codec'

So the bean "hl7codec" is already recognized.
Setting the codec in the URL does not work since IPF is hiding the "setCodec" method of original Camel class.
Due to the documentation [https://oehf.github.io/ipf/ipf-platform-camel-ihe-mllp/mllpCustom.html] the protocol prefix is "mllp".
I changed the route definition to:

from("mllp://localhost:7000?sync=true")

but still the same exception like above.

Caused by: org.apache.mina.core.buffer.BufferDataException: dataLength: 189616968
        at org.apache.mina.core.buffer.AbstractIoBuffer.prefixedDataAvailable(AbstractIoBuffer.java:2295) ~[mina-core-2.0.19.jar:?]
        at org.apache.mina.filter.codec.serialization.ObjectSerializationDecoder.doDecode(ObjectSerializationDecoder.java:93) ~[mina-core-2.0.19.jar:?]
        at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:180) ~[mina-core-2.0.19.jar:?]
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:253) ~[mina-core-2.0.19.jar:?]

Any ideas?

@ohr ohr added the question label Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants