|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectionic.Msmq.Queue
public class Queue
The Queue class represents a message queue in MSMQ.
Applications can instantiate a Queue, then perform send and receive operations on the queue, using instances of the Message type.
Queue also exposes several static methods for Queue management, to support creation and deletion of message queues.
Nested Class Summary | |
---|---|
static class |
Queue.Access
The Queue.Access enum provides options for access to the MSMQ Queue: Either Receive, Send, or both. |
Constructor Summary | |
---|---|
Queue(java.lang.String queueName)
Call this constructor to open a queue by name for SEND and RECEIVE operations. |
|
Queue(java.lang.String queueName,
Queue.Access access)
Call this constructor to open a queue with the specified access |
Method Summary | |
---|---|
void |
close()
Close the queue. |
static Queue |
create(java.lang.String queuePath,
java.lang.String queueLabel,
boolean isTransactional)
Create a queue by name, with the given queue label and transactional access. |
static void |
delete(java.lang.String queuePath)
Delete a queue by the given name. |
java.lang.String |
getFormatName()
Gets the formatname on the queue. |
java.lang.String |
getLabel()
Gets the label on the queue. |
java.lang.String |
getName()
Gets the name of the queue. |
boolean |
isTransactional()
Gets the transactional setting for the queue. |
Message |
peek()
Peek at the queue and return a message without dequeueing it. |
Message |
peek(int timeout)
Peek at the queue and return a message without dequeueing it, |
Message |
receive()
Poll the queue to receive one message, with an infinite timeout. |
Message |
receive(int timeout)
Poll the queue to receive one message, with the given timeout. |
void |
send(byte[] b)
Send a byte array as a Message. |
void |
send(Message msg)
Send a Message on the queue. |
void |
send(Message msg,
boolean highPriority)
Send a Message, with the given value for high priority. |
void |
send(Message msg,
boolean highPriority,
TransactionType t)
Send a Message, with the given transaction type, and with the given setting for high priority. |
void |
send(Message msg,
TransactionType t)
Send a Message, with the given transaction type. |
void |
send(java.lang.String s)
Send a string as a Message, using UTF-8 encoding. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Queue(java.lang.String queueName) throws MessageQueueException
Call this constructor to open a queue by name for SEND and RECEIVE operations.
Here's an example of how to use it, to send a simple message:
Queue queue= new Queue(fullname); String body = "Hello, World!"; String label = "Greeting"; String correlationId= "L:none"; Message msg= new Message(body, label, correlationId); queue.send(msg);
MessageQueueException
public Queue(java.lang.String queueName, Queue.Access access) throws MessageQueueException
MessageQueueException
Method Detail |
---|
public static Queue create(java.lang.String queuePath, java.lang.String queueLabel, boolean isTransactional) throws MessageQueueException
Create a queue by name, with the given queue label and transactional access.
Example:
String fullname= ".\\private$\\" + qname; String qLabel="Created by " + this.getClass().getName() + ".java"; boolean transactional= false; // should the queue be transactional queue= Queue.create(fullname, qLabel, transactional);
MessageQueueException
public static void delete(java.lang.String queuePath) throws MessageQueueException
MessageQueueException
public void send(Message msg, boolean highPriority, TransactionType t) throws MessageQueueException
MessageQueueException
public void send(Message msg, TransactionType t) throws MessageQueueException
MessageQueueException
public void send(Message msg, boolean highPriority) throws MessageQueueException
MessageQueueException
public void send(Message msg) throws MessageQueueException
MessageQueueException
public void send(java.lang.String s) throws MessageQueueException, java.io.UnsupportedEncodingException
MessageQueueException
java.io.UnsupportedEncodingException
public void send(byte[] b) throws MessageQueueException
MessageQueueException
public Message receive(int timeout) throws MessageQueueException
If the timeout expires before a message becomes available, the method will throw an exception.
MessageQueueException
public Message receive() throws MessageQueueException
MessageQueueException
public Message peek() throws MessageQueueException
MessageQueueException
public Message peek(int timeout) throws MessageQueueException
If the timeout expires before a message becomes available, the method will throw an exception.
MessageQueueException
public void close() throws MessageQueueException
MessageQueueException
public java.lang.String getName()
public java.lang.String getLabel()
public java.lang.String getFormatName()
public boolean isTransactional()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |