Hello All! We are using Proton-j Reactor framework & are trying to offer Send API in our EventHub Client offering to talk to Microsoft Azure Event Hubs (EventSender.Send(eventData)).
To simplify the scenario lets say, we mapped each EventSender (in our client) to 1 Reactor – which maps to 1 Connection – which has 1 Session – which has only 1 SenderLink. We run Reactor on 1 dedicated Thread. Users of our EventHubs client Framework can call Send(..) concurrently from different threads. We are trying to see what’s the best way to implement this using the current Reactor Artifacts. - Given that, the Reactor implementation assumes SenderLink.send() happens on the Same thread as that of Reactor – what was the artifact intended in Reactor’s Design, to be used – to implement Send? To explain more – ‘onReceive’ is naturally a reactive event – but Send is an Action which could start from a completely different thread – so, how should Send tap into Reactor’s event-delegation model? Here’s the challenge we are facing: Lets imagine the below events in chronological order: 1. User created a SenderLink 2. user started 10 parallel sends – our Client SDK parked all of this sends in a SendWaiter Queue – so that we will invoke the SenderLink.send() based on a Reactor Event (so that they run on the same thread) 3. Service responded with Link Attach frame & issued a Credit of 300 4. Based on this event our SDK created 10 new Delivery’s and completed all 10 sends on the Reactor Thread. 5. Now, if the User thread invokes more Sends – what are the events on which we can invoke these sends – so that they can run on the Same thread of Reactor ? Currently we implemented a SendPump – using Timer.schedule – every 50ms – feed off our SendWaiter Queue and invoke SenderLink.send() on the Reactor Thread. Looks like, using ‘Selectable’ could be a way – but, wanted to double-check the direction… 'Timer approach’ currently works, but doesn’t look like the right way & hence the probe… Thanks in Advance! Sree
