Şu satırı dahil ederiz
import org.apache.ignite.IgniteQueue;
Kalıtımı şöyledir
IgniteQueue<T> extends BlockingQueue<T>
take metodu - Blocking
Kuyruğu yaratmak için queue name + capacity + CollectionConfiguration belirtilir
Örnek
Şöyle yaparız
IgniteQueue<String> queue = Ignition.ignite().queue("queueName", 0, null); int TIMES = 10; for (int i = 0; i < RETRIES; i++) { String item = UUID.randomUUID() + "_" + i; queue.put(item); println("Queue item has been added: " + item); } // IgniteQueue is fully compatible with Java library. for (String item : queue) println("Queue item: " + item); // Take items from queue head. for (int i = 0; i < TIMES; i++) println("Queue item has been read from queue head: " + queue.take()); // Take items from queue head once again. for (int i = 0; i < TIMES; i++) println("Queue item has been read from queue head: " + queue.poll());
Hiç yorum yok:
Yorum Gönder