dimanche 9 février 2020

Spring Integration tests with queue channels

In Spring Integration I have a DSL setup that looks something like this:

                                       --->                                        --->
                                       --->                                        --->
Messages --> Gateway ---> QueueChannel ---> MessageHandler(worker) -> QueueChannel ---> MH worker2 --> ...
                                       --->                                        --->
                                       --->                                        --->

I want to write an integration test for that, which will test if the message was in proper channels. I do not enrich headers right now anywhere, so I wanted to use:

this.someChannel.receive(TIMEOUT)

unfortunately, as I understand, it is blocking only the main thread of test, not all, so it cannot receive any message sent asynchronously. I know, that there exists something like:

this.someChannel.getReceiveCount()

it gives me good results, but checking it is not enough for me. How can I deal with it, to receive messages sent to queues in async way?

EDIT: It is important, that I need it, because the message is changed during going through workflow

Aucun commentaire:

Enregistrer un commentaire