1
votes

I have a stream comprising of

Source | ProcessorP1 | ProcessorP2 | ProcessorP3 | ProcessorP4 | Sink

I'm using ProcessorP1 as my tasklaunchrequest-transform processor. I'm using this to launch a task via task-launcher. Now I need to pass on my payload from ProcessorP1 to ProcessorP2 and also invoke the task; The TaskLaunchRequest has no way to carry the payload as it is ignored.

https://github.com/spring-cloud-stream-app-starters/tasklaunchrequest-transform/blob/master/spring-cloud-starter-stream-processor-tasklaunchrequest-transform/README.adoc

Is there a way to pass on the payload to next processor in my stream?

1
Could you clarify about what you mean by the payload from Processor1. The payload is going to be your TaskLaunchRequest which will be carried to the task-launcher. tasklaunchrequest-transform ignores any incoming payload and headers.sobychacko
The ProcessorP1 takes input from Source, it then discards it and creates a new TaskLaunchRequest which it sends on its output channel. This is then consumed by the task-launcher attached at the tap and is also consumed by ProcessorP2. I wanted to know if there is a way to NOT ignore the incoming payload from Source and be able to pass that on to ProcessorP2, or include that incoming payload in the TaskLaunchRequest itself.Kanika Sharma

1 Answers

0
votes

Since the tasklaunchrequest-transform-processor ignores the incoming payload, in order to accomplish what you are looking for, you need to customize the processor, i.e, you have to change the logic in the processor so that it takes the incoming payload and attaches to the TaskLaunchRequest somehow. If the incoming payload is a String type, you can then add that as a environment property or a command line arg in the TaskLaunchRequest - then essentially pass this modified request down through the stream. Basically, you need to replace your ProcessorP1 with a custom takslaunchrequest-transform-processor that does this.

See here for some guidelines for patching the out of the box applications: https://docs.spring.io/spring-cloud-stream-app-starters/docs/current/reference/htmlsingle/#_patching_pre_built_applications or creating new ones: https://docs.spring.io/spring-cloud-stream-app-starters/docs/current/reference/htmlsingle/#_creating_new_stream_application_starters_and_generating_artifacts