Skip to content
Advertisement

Tag: queue

Browse, read, and remove a message from a queue using IBM MQ classes

I’m writing a simple Java application using MQ classes for Java with Eclipse. Right now I’m able to browse a remote queue without removing the messages stored. Here is the code of the reading cycle: Main question: After the read message line and before moving the cursor to the next message how can I remove the message from the queue?

How do I instantiate a Queue object in java?

When I try: The compiler is giving me an error. Any help? Also, if I want to initialize a queue do I have to implement the methods of the queue? Answer A Queue is an interface, which means you cannot construct a Queue directly. The best option is to construct off a class that already implements the Queue interface, like

Is there a fixed sized queue which removes excessive elements?

I need a queue with a fixed size. When I add an element and the queue is full, it should automatically remove the oldest element. Is there an existing implementation for this in Java? Answer There is no existing implementation in the Java Language and Runtime. All Queues extend AbstractQueue, and its doc clearly states that adding an element to

Advertisement