开发者

problem to return value from response queue

i am using Rabbitmq Java client API.i am sending two number from GUI to producer and producer put into queue another side consumer can listen the queue and read it and perform the addition of two number and put result on queue then again my producer will listen the my response queue and retrieve the result. code:

while (runInfinite) { QueueingConsumer.Delivery delivery; try { delivery = consumer.nextDelivery(); } catch (InterruptedException ie) { continue; } System.out.println("Result received-" + new String(delivery.getBody())); }

My problem is when the while loop run infinite time and i want to send the fetched result to an GUI to show result.i want to know that,开发者_运维知识库 it is possible ,if possible then what i do?

Thanks


You can use two queues. The GUI puts the numbers in 1 queue. and the background job puts it another Queue. But I do not think you want something like a queue to do the above thing.

Look at events actions and callbacks with respect to your GUI and see if they are suitable for the things you want to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜