flume icon indicating copy to clipboard operation
flume copied to clipboard

Example showing request + response

Open brandonros opened this issue 3 years ago • 5 comments

I know it's pretty custom and not a typical usecase but I think it'd be pretty cool to show the power of the library to show how to do exact request + response. aka, tx, wait for rx back, but don't risk getting the rx from a different tx out of order.

brandonros avatar Mar 14 '22 20:03 brandonros

I agree, an example of this would be useful! I'll see whether I get time to add one in the next few weeks.

zesterer avatar Mar 14 '22 20:03 zesterer

Is this possible without some kind of request/reply correlation IDs? my fear is that you would transmit a message, then switch to being a receiver, but receive a response to a message that you didn’t just transmit. For example like out of order

brandonros avatar Mar 14 '22 21:03 brandonros

Flume guarantees ordering from the perspective of a particular thread. In general, you'd probably want to have two channels for this to work: one to send on, one to receive on. You also wouldn't want to share them between many threads because the messages might be received by the wrong thread.

zesterer avatar Mar 14 '22 23:03 zesterer

can you think of a way to solve multi-threaded exact request/response with channels or not really?

brandonros avatar Mar 15 '22 00:03 brandonros

Is this possible without some kind of request/reply correlation IDs? my fear is that you would transmit a message, then switch to being a receiver, but receive a response to a message that you didn’t just transmit. For example like out of order

The way this works in xtra is by using Flume one channel from sender to receiver, and sending a oneshot channel half along with the request that needs a response. There are alternate designs of course - maybe using IDs like you said.

Restioson avatar Mar 15 '22 09:03 Restioson