camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Huffman <robert.huff...@gmail.com>
Subject Add a DataFormat programatically
Date Sun, 01 Jan 2017 17:58:19 GMT
I'm having trouble adding the ProtobufDataFormat to a route. I have
ActiveMQ BytesMessages whose bodies are Protobuf messages.

The documentation (http://camel.apache.org/protobuf.html) certainly looks
straightforward, so here's what I have:

    ProtobufDataFormat protobufFormat = new ProtobufDataFormat();
    context.addRoutes(new RouteBuilder() {
      public void configure() throws Exception {
        from("jms:queue:test)
            .unmarshal(protobufFormat)
            .process((exchange) -> {...});

But this gives me an exception:

Caused by: java.lang.IllegalArgumentException: Data format 'protobuf' could
not be created. Ensure that the data format is valid and the associated
Camel component is present on the classpath
at
org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:107)
at
org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:88)
at
org.apache.camel.model.MarshalDefinition.createProcessor(MarshalDefinition.java:177)
at
org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:545)
at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:506)
at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:222)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1068)
... 42 more


Any ideas?

Also, is there a way to programatically add the ProtobufDataDefinition to
the CamelContext when I create it so I can use it in routes without
instantiating it? (I tried adding it as a serivce, registering it in the
registry, and adding it to the context's data format map, and I always got
the same exception as the one above.)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message