Hi

Maybe its streaming see this FAQ
http://camel.apache.org/why-is-my-message-body-empty.html

On Fri, Mar 28, 2014 at 8:57 AM, John Dubchak <[email protected]> wrote:
> Hi,
>
> I am trying to integrate another part of our system that will publish XML
> events to a camel route.  I am having difficulty getting JAXB and my camel
> route to work correctly and I've narrowed it down to the following that
> shows my xpath expression I expect to match isn't.
>
> At this point I'd appreciate any help on this - I *really* need to get this
> finished, and I've spent days trying to resolve this.
>
> Info:
> 1 - Route definition
> 2 - Log file
> 3 - XML
>
> Thanks,
> John
>
> [1] Route:
>
> DataFormat jaxb = new JaxbDataFormat("com.example.services.schemas.events");
> Namespaces ns = new Namespaces("",
> "http://www.example.com/services/resource/schemas/events";);
>
> from("activemq:my.events")
>     .choice()
> .when(ns.xpath("/event/context[type='inbound:file-receive']"))
>             .to("direct:inboundHandler")
>     .otherwise().log("Processing ${id} did not match namespace.");
>
> from("direct:inboundHandler")
>     .unmarshal(jaxb)
>     .process(new Processor() {
>         @Override
>         public void process(Exchange exchange) throws Exception {
>             System.out.println("trying to get the marshalled event");
>             Event evt = exchange.getIn().getBody(Event.class);
>             System.out.println("event.type = " + EventUtils.getType(evt));
>         }
>     });
>
> [2] Log File:
>
> 00:29:05,656 | DEBUG | umer[my.events] | EndpointMessageListener          |
> 106 - org.apache.camel.camel-jms - 2.10.7 | Endpoint[activemq://my.events]
> consumer received JMS message: ActiveMQTextMessage {commandId = 3,
> responseRequired = false, messageId =
> ID:dubchak-mbp-53315-1395991558715-8:1:-1:1:1, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:dubchak-mbp-53315-1395991558715-8:1:-1:1, destination =
> queue://my.events, transactionId = null, expiration = 0, timestamp =
> 1395991745644, arrival = 0, brokerInTime = 1395991745644, brokerOutTime =
> 1395991745647, correlationId = null, replyTo = null, persistent = false,
> type = null, priority = 4, groupID = null, groupSequence = 0,
> targetConsumerId = null, compressed = false, userID = null, content = null,
> marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
> size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true,
> droppable = false, text = <?xml version="1.0" encoding="UTF-8"
> standalo.../tns:event>
> }
> *00:29:05,676 | DEBUG | umer[my.events] | ChoiceProcessor                  |
> 100 - org.apache.camel.camel-core - 2.10.7 | #0 - XPath:
> /event/context[type='inbound:file-receive'] matches: false for:
> Exchange[JmsMessage[JmsMessageID:
> ID:dubchak-mbp-53315-1395991558715-8:1:-1:1:1]]**
> **00:29:05,676 | INFO  | umer[my.events] | route3
> | 100 - org.apache.camel.camel-core - 2.10.7 | Processing
> ID:dubchak-mbp-53315-1395991558715-8:1:-1:1:1 did not match namespace.**
> **00:29:07,634 | DEBUG | .0.1:53353@61613 | Transport
> | 63 - org.apache.activemq.activemq-core - 5.7.0 | Transport Connection to:
> tcp://127.0.0.1:53353 failed: java.io.EOFException**
> **java.io.EOFException**
> **    at
> java.io.DataInputStream.readByte(DataInputStream.java:267)[:1.7.0_45]**
> **    at
> org.apache.activemq.transport.stomp.StompWireFormat.readHeaderLine(StompWireFormat.java:155)[63:org.apache.activemq.activemq-core:5.7.0]**
> **    at
> org.apache.activemq.transport.stomp.StompWireFormat.readLine(StompWireFormat.java:148)[63:org.apache.activemq.activemq-core:5.7.0]**
> **    at
> org.apache.activemq.transport.stomp.StompWireFormat.parseAction(StompWireFormat.java:170)[63:org.apache.activemq.activemq-core:5.7.0]**
> **    at
> org.apache.activemq.transport.stomp.StompWireFormat.unmarshal(StompWireFormat.java:98)[63:org.apache.activemq.activemq-core:5.7.0]**
> **    at
> org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:229)[63:org.apache.activemq.activemq-core:5.7.0]**
> **    at
> org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:221)[63:org.apache.activemq.activemq-core:5.7.0]**
> **    at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:204)[63:org.apache.activemq.activemq-core:5.7.0]**
> **    at java.lang.Thread.run(Thread.java:744)[:1.7.0_45]*
> 00:29:07,636 | DEBUG | .0.1:53353@61613 | ManagementContext                |
> 63 - org.apache.activemq.activemq-core - 5.7.0 | Unregistering MBean
> org.apache.activemq:BrokerName=default,Type=Connection,ConnectorName=stomp,Connection=ID_dubchak-mbp-53315-1395991558715-8_1
> 0
>
> [3] XML:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <event xmlns="http://www.example.com/services/resource/schemas/events";
>        event-id="12345" timestamp="2014-03-27T12:50:10.993-07:00">
>     <context>
>         <type>inbound:file-receive</type>
>         <attributes>
>             <attribute>
>                 <name>source</name>
> <value>file:///integration/work/provider_directory/in/infile.tar.gz</value>
>             </attribute>
>             <attribute>
>                 <name>target</name>
> <value>file:///integration/work/provider_directory/ready/reformatted.tar.gz</value>
>             </attribute>
>             <attribute>
>                 <name>datasource</name>
>                 <value>foo</value>
>             </attribute>
>         </attributes>
>     </context>
>     <source>
>         <uri>
>             <host-name>localhost</host-name>
>             <host-id>localhost</host-id>
>             <domain>example.com</domain>
> <fully-qualified>file:///integration/work/provider_directory/in/infile.tar.gz</fully-qualified>
>         </uri>
>     </source>
>     <target>
>         <uri>
>             <host-name>localhost</host-name>
>             <host-id>internal2.example.com</host-id>
>             <domain>example.com</domain>
> <fully-qualified>file:///integration/work/provider_directory/ready/aetna_v4_05.zip</fully-qualified>
>         </uri>
>     </target>
>     <event-data>
>         <payload/>
>     </event-data>
> </event>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Reply via email to