I know that ignite cache does provide a continuous query function to allow event trigger function. But what about the ignite queue? How could we implement a producer-consumer model upon the ignite queue? For example, producer put object in the queue, then the consumer process the object by somethinbg like queue.onAdd(function to do something)
or queue.onRemove(function to do something)
.
Asked
Active
Viewed 130 times
0
-
Please provide enough code so others can better understand or reproduce the problem. – Community Sep 13 '21 at 19:36
1 Answers
0
Can't you just add use it as a blocking queue?
Producer:
IgniteQueue<Object> queue = ignite.queue("myQueue", 0, new CollectionConfiguration());
queue.put("obj");
Consumers:
for(;;)
System.out.println(queue.take());

Alexandr Shapkin
- 2,350
- 1
- 6
- 10
-
Thanks for answering. Maybe I did not interpret my question correctly, what I want is more like a pub-sub model, which means that when the producer puts something in the queue, it will notify the consumer using an event triggering the consumer to operate on the queue. In another word, like a continuous query (not exactly a query but just polling the queue) which works on a queue. – Jiayu Sep 11 '21 at 06:43
-
Seems that you are looking for Ignite messaging feature ignite.apache.org/features/messaging.html Docs: ignite.apache.org/docs/latest/messaging – Alexandr Shapkin Sep 12 '21 at 22:00