[Hawkular-dev] [metrics] Looking for advice on ListenableFuture usage

John Sanda jsanda at redhat.com
Fri Jan 16 16:09:25 EST 2015


I am not questioning the usefulness of MessageProcessor.sendRPC. I am wondering why you need/want ListenableFuture. If you want want to obtain responses asynchronously, use a message listener. I see that there is already code like BasicMessageListener that abstracts a lot of stuff for example. Can you point me to an example where the ListenableFuture is used? Maybe that will help me understand.


> On Jan 16, 2015, at 12:52 PM, John Mazzitelli <mazz at redhat.com> wrote:
> 
> I find trying to write the same functionality in straight JMS will show the usefulness of MessageProcessor.sendRPC.
> 
> Again, this is to support RPC-like functionality - which isn't trival in JMS (as opposed to fire-and-forget, 1-way messaging). You wouldn't use this sendRPC if you are just shooting a message on the bus and not expecting a direct response to that message.
> 
> ----- Original Message -----
>> 
>>> On Jan 16, 2015, at 12:20 PM, John Mazzitelli <mazz at redhat.com> wrote:
>>> 
>>>> I haven’t looked at the code too closely yet, but why the need for
>>>> ListenableFuture to get the response from the bus? JMS/messaging is
>>>> already
>>>> asynchronous.
>>> 
>>> In the RPC-like use-case, I send a message on the bus, and I expect to get
>>> a response back from that message. This API helps hide the annoying JMS
>>> boiler-plate code you'd have to write to do that RPC-like functionality.
>> 
>> But aren’t you just putting in place more boiler plate with ListenableFuture?
>> The problem with Java futures is that obtaining the result is blocking.
>> ListenableFuture allows you to get the results asynchronously. We already
>> get the results asynchronously with JMS right? I understand the desire for
>> abstracting the JMS code, but I don’t what ListenableFuture buys you.
> 
> _______________________________________________
> hawkular-dev mailing list
> hawkular-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hawkular-dev




More information about the hawkular-dev mailing list