You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by xingjl6280 <xi...@163.com> on 2020/04/22 02:26:19 UTC

Is there a QUEUE based messaging?

hi team,

I'm looking for a queue based messaging, comparing to topic, i dont want all
subscriber received the message but one of them.

please kindly advise

thank you



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Is there a QUEUE based messaging?

Posted by akorensh <al...@gmail.com>.
Hi,
  Like I mentioned you can broadcast to specific nodes, but for your use
case a QUEUE might be the best approach.
Thanks, Alex



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Is there a QUEUE based messaging?

Posted by xingjl6280 <xi...@163.com>.
thanks for the reply

but for the queue based messaging, there's an implicit requirement - Load
Balancing

To conclude my requirement
1. only one subscriber received the msg, but not to broadcast and let
subscribers synchronously decide who will process it, which wastes network
resource unneccessarily
2. subscribers are also clustered, means there is Load Balance, just like
how we use RabbitMQ queue without topic

My plan B is to use the distributed data structure "QUEUE", and let all
subscribers loop to snatch message.
I also think about calling service deployed in service asynchronously,but
considering back pressure, this approch won't work.

So it's confirmed that ignite doesnt have a queue based messaging, and I
have to go for my plan B? 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Is there a QUEUE based messaging?

Posted by akorensh <al...@gmail.com>.
You can use topic messaging, but vary the specific nodes receiving the
message:
see:
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cluster/ClusterGroup.html

and: https://apacheignite.readme.io/docs/messaging#section--example-

set an attribute on the node you want to receive messages:
then use this:http://apache-ignite-users.70518.x6.nabble.com/images/more.png


        Ignite ignite = Ignition.ignite();

      // Cluster group over all nodes that have the user attribute "group"
set to the value "worker".
        ClusterGroup workerNodes = ignite.cluster.forAttribute("group",
"worker");

        IgniteMessaging rmtMsg = ignite.message(workerNodes);

     // Add listener for unordered messages on all remote nodes.
        rmtMsg.remoteListen("MyOrderedTopic", (nodeId, msg) -> {
        System.out.println("Received ordered message [msg=" + msg + ",
from=" + nodeId + ']');

        return true; // Return true to continue listening.
        });

     // Send ordered messages to remote nodes.
        for (int i = 0; i < 10; i++)
        rmtMsg.sendOrdered("MyOrderedTopic", Integer.toString(i),0);



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/