Search code examples
spring-cloud-streamspring-cloud-dataflow

Create Stream with one source, two parallel processors and one sink in Spring Cloud Data Flow


I am trying to create a stream in Spring Cloud Data Flow with

  1. One source i.e. order-source and Order message will be published to the RabbitMQ Topic/Queue.

  2. Two parallel processors i.e. product-processor and shipment-processor Both of these processors will be subscribers to the RabbitMQ Topic/Queue and gets the Order message and each of them will process these Order message individually and update the Order and the Order message will be published to the RabbitMQ Topic/Queue.

  3. One sink i.e. payment-sink The sink will be the subscriber to the RabbitMQ Topic/Queue and will get the Order message and based on the Order message, will complete the Payment process.

I tried the following command and deployed

stream create --name order-to-payment --definition 'order-source | product-processor|shipment-processor | payment-sink'

But graphically in Spring Cloud Data Flow it looks like as follows:

Stream Diagram

But I am looking something like below

Paraller processors

Is it possible to achieve this? As Spring Cloud Data Flow is not allowing it to connect two processors from one source as well as not able to connect from two processor to one sink graphically?

Thanks, David.


Solution

  • You can have DAG with dataflow using named destinations, please check it here: http://docs.spring.io/spring-cloud-dataflow/docs/1.2.2.RELEASE/reference/htmlsingle/#spring-cloud-dataflow-stream-advanced

    You will need to send your messages via named destinations and compose the flow from them. Let me know if you have trouble going through the docs and I can post an example here.