3

I have spring integration flows. One for the file poller and other one is to process the file

flow # 01

poll the file in C:/testing directory

files comes goes to "process" queue

flow # 02 (from "process")

Transformer(new FindTheDepartItbelongs()) //basically file has to match to some depoartment
.transform(new FileParserTransformer()
.transformer(new CustomerTransformer()
.handle (o -> {})

The issue is if the FindTheDepartItBelongs cannot find the department then it has to stop the rest of the flow and send the message to some error queue.

If I return null from the transformer it does not work.

Is there any other way to achieve the same ?

Naman
  • 27,789
  • 26
  • 218
  • 353
Makky
  • 17,117
  • 17
  • 63
  • 86
  • Transformers can't return null; you need to show your complete flow configuration so we can help you with error handling configuration. – Gary Russell Nov 28 '18 at 14:05
  • @GaryRussell I already have error handler but I am interested to know if I can stop the flow in between? – Makky Nov 28 '18 at 14:11
  • A transformer cannot return null, but a `.handle()` method can and the flow just stops. It won't go to the error channel, though; you have to throw an exception for that. – Gary Russell Nov 28 '18 at 14:23
  • @GaryRussell I got it mate . Thanks if you have sometime can you please help me with this question https://stackoverflow.com/questions/53521593/taskexecutor-is-not-working-spring-integration – Makky Nov 28 '18 at 14:29
  • You can leave that as an answer if you want I'll accept – Makky Nov 28 '18 at 14:29

1 Answers1

3

A transformer cannot return null, but a .handle() method can and the flow just stops. It won't go to the error channel, though; you have to throw an exception for that.

TuGordoBello
  • 4,350
  • 9
  • 52
  • 78
Gary Russell
  • 166,535
  • 14
  • 146
  • 179