0

After long time of research i still have no acceptable solution for my purposes.

Intend: I'm trying to have multiple Endpoints/Components which are generating exchanges with proprietary content. (1st row 1st col in picture)

Thus exchanges should be normalized by a normalizer/translator (1st row 2nd col in picture)

Finally this normalized data should be processed. (Saved to database, did some aggregations, calculating some results).

After a result is generated, a completely new exchange should be generated and populated to routes, where this processor is located in the "from" statement. (2nd Row) -> Data should be translated to proprietary data -> send to endpoint

Questions & Preliminary Findings

  • A Processor could not be located in the "from" statement directly. I only found some workarounds in the manner " from (direct:somemessages)" which is created in the processor by to(direct:somemessages)

  • The Processor could be programmes as a Component with an endpoint. And the asynchronus messages could be published with the corresponding Consumer

Example Route Ingoing (1st row)

  <route id="bar">
        <from uri="mqtt"/>
        <to uri="TranslateMQTT2MyModel"/>
        <to uri="ProcessData"/>
    </route>

Example Route Outgoing (i would like to have) (2nd row)

  <route id="out">
        <from uri="ProcessData"/>
        <to uri="TranslateMyModel2MQTT"/>
        <to uri="mqtt"/>
    </route>

So how I can achieve my purposes? Is one of my two outcomes a good solution?

Example of schematic workflow

ChrisSLDS
  • 1
  • 3

1 Answers1

0

You could write a "ProcessData" component that is a consumer, but I don't think you need to do that.

I think you can use the asynchronous capability of the SEDA component, so I think what you're looking for is something like:

<route id="bar">
    <from uri="mqtt"/>
    <to uri="TranslateMQTT2MyModel"/>
    <to uri="seda:processAndReply"/>
</route>

<route id="out">
    <from uri="seda:processAndReply" />
    <to uri="ProcessData"/>
    <to uri="TranslateMyModel2MQTT"/>
    <to uri="mqtt"/>
</route>

The SEDA component works similarly to direct as you described, but direct is synchronous and SEDA is asynchronous. (Also note the VM and Direct-VM components if you need to link between Camel Contexts with the same JVM).

Screwtape
  • 1,337
  • 2
  • 12
  • 27