public interface MessageQueue
For a code example that shows how to write a JMP application to process a conversational transaction, see the topic "Conversational transactions" in the IMS Application Programming guide documentation.
In a non-conversational transaction, it is possible to code the application with a message loop
that retrieves messages until IMS indicates that no more messages exist on the queue. To support
this style of programming, the getUnique(IOMessage) method returns
true if there is a message to retrieve from the queue and false if there is not.
IOMessage,
MessageDestinationSpec| Modifier and Type | Field and Description |
|---|---|
static MessageDestinationSpec |
DEFAULT_DESTINATION
Using this constant value will send the message to the default destination
of the transaction.
|
| Modifier and Type | Method and Description |
|---|---|
void |
change(java.lang.String destinationName,
java.lang.String altPCBName)
Change the destination of a message to IMS.
|
AIB |
getAIB()
Returns the
AIB instance associated with the most recent DL/I call. |
boolean |
getNext(java.nio.ByteBuffer buffer)
Retrieves the next segment of the message from IMS.
|
boolean |
getNext(IOMessage message)
Retrieves the next segment of the message from IMS.
|
boolean |
getUnique(java.nio.ByteBuffer buffer)
Retrieves the first segment of an input message from IMS.
|
boolean |
getUnique(IOMessage message)
Retrieves the first segment of an input message from IMS.
|
void |
insert(java.nio.ByteBuffer buffer)
Send an output message to IMS.
|
void |
insert(java.nio.ByteBuffer buffer,
MessageDestinationSpec mds)
Send an output message to IMS.
|
void |
insert(java.nio.ByteBuffer buffer,
java.lang.String alternatePcbName)
Send an output message to IMS.
|
void |
insert(java.nio.ByteBuffer buffer,
java.lang.String alternatePcbName,
java.lang.String modName) |
void |
insert(IOMessage message,
MessageDestinationSpec mds)
Send an output message to IMS.
|
void |
purge(java.lang.String alternatePcbName)
A PURG call tells IMS TM that the message built against the specified I/O PCB,
or alternate PCB (with the ISRT call) is complete.
|
void |
purge(java.lang.String alternatePcbName,
IOMessage message)
Use the PURG call to send output messages to several different terminals.
|
void |
purge(java.lang.String alternatePcbName,
IOMessage message,
java.lang.String modName)
Use the PURG call to send output messages to several different terminals.
|
static final MessageDestinationSpec DEFAULT_DESTINATION
boolean getUnique(IOMessage message) throws DLIException
message - the IOMessage object to receive the messageTMException - if the operation failsDLIExceptionboolean getUnique(java.nio.ByteBuffer buffer)
throws DLIException
Uses a ByteBuffer as the output object. The
ByteBuffer object can be either direct or non-direct. If running
in a 64-bit JVM and require the use of a Direct ByteBuffer, a
31-bit ByteBuffer will need to be allocated. See
Application#get31BitDirectByteBuffer(Int)
message - the ByteBuffer object to receive the messageTMException - if the operation failsDLIExceptionApplication#get31BitDirectByteBuffer(int)},
ByteBuffer.allocateDirect(int)boolean getNext(IOMessage message) throws DLIException
For a code example that shows how to handle multi-segment messages, see the topic "Handling multi-segment messages" in the IMS Application Programming guide documentation.
message - the IOMessage object to receive the messagetrue if the message was successfully retrieved, false if no more
messagesTMException - if the operation failsDLIExceptionboolean getNext(java.nio.ByteBuffer buffer)
throws DLIException
Uses a ByteBuffer as the output object. The
ByteBuffer object can be either direct or non-direct. If running
in a 64-bit JVM and require the use of a Direct ByteBuffer, a
31-bit ByteBuffer will need to be allocated. See
Application#get31BitDirectByteBuffer(Int)
buffer - the ByteBuffer object to receive the messagetrue if the message was successfully retrieved, false if no more
messagesTMException - if the operation failsDLIExceptionApplication#get31BitDirectByteBuffer(int)},
ByteBuffer.allocateDirect(int)void insert(IOMessage message, MessageDestinationSpec mds) throws DLIException
The following code example shows how to return the message to the default destination:
messageQueue.insert(outputMessage, MessageQueue.DEFAULT_DESTINATION);
The following code example shows how to perform immediate program switching to an alternate IOPCB:
MessageDestinationSpec mds = new MessageDestinationSpec();
mds.setAlternatePCBName("alternatePCBName");
mds.setDestination("newDestination");
messageQueue.insert(outputMessage, mds);
The following code example shows how to perform deferred program switching:
spaMessage.setTrancodeName("newTran");
messageQueue.insert(spaMessage, MessageQueue.DEFAULT_DESTINATION);
For more details on program switching in JMP and JBP applications, see the topic "Program switching in JMP and JBP applications" in the IMS Application Programming guide documentation.
message - the IOMessage object to send the messagemds - the MessageDestinationSpec object that
specifies the destination to route the message toTMException - if the operation failsDLIExceptionvoid insert(java.nio.ByteBuffer buffer)
throws DLIException
Uses a ByteBuffer as the output object. The
ByteBuffer object can be either direct or non-direct. If running
in a 64-bit JVM and require the use of a Direct ByteBuffer, a
31-bit ByteBuffer will need to be allocated. See
Application#get31BitDirectByteBuffer(Int)
The following code example shows how to return the message to the default destination:
ByteBuffer buffer = ByteBuffer.allocate(40);
InputMessage input = new InputMessage(buffer);
input.setLL(10)
input.setZZ(0)
input.setInputData("SAMPLE")
messageQueue.insert(buffer);
buffer - the ByteBuffer object to send the messageTMException - if the operation failsDLIExceptionApplication#get31BitDirectByteBuffer(int)},
ByteBuffer.allocateDirect(int)void insert(java.nio.ByteBuffer buffer,
MessageDestinationSpec mds)
throws DLIException
The following code example shows how to return the message to the default destination:
Uses a ByteBuffer as the output object. The
ByteBuffer object can be either direct or non-direct. If running
in a 64-bit JVM and require the use of a Direct ByteBuffer, a
31-bit ByteBuffer will need to be allocated. See
Application#get31BitDirectByteBuffer(Int)
messageQueue.insert(buffer, MessageQueue.DEFAULT_DESTINATION);
The following code example shows how to perform immediate program switching to an alternate IOPCB:
MessageDestinationSpec mds = new MessageDestinationSpec();
mds.setAlternatePCBName("alternatePCBName");
mds.setDestination("newDestination");
messageQueue.insert(buffer, mds);
For more details on program switching in JMP and JBP applications, see the topic "Program switching in JMP and JBP applications" in the IMS Application Programming guide documentation.
buffer - the ByteBuffer object to send the messagemds - the MessageDestinationSpec object that
specifies the destination to route the message toTMException - if the operation failsDLIExceptionApplication#get31BitDirectByteBuffer(int)},
ByteBuffer.allocateDirect(int)void insert(java.nio.ByteBuffer buffer,
java.lang.String alternatePcbName)
throws DLIException
Uses a ByteBuffer as the output object. The
ByteBuffer object can be either direct or non-direct. If running
in a 64-bit JVM and require the use of a Direct ByteBuffer, a
31-bit ByteBuffer will need to be allocated. See
Application#get31BitDirectByteBuffer(Int)
The following code example shows how to perform immediate program switching to an alternate IOPCB:
messageQueue.insert(buffer, "ALTPCB1");For more details on program switching in JMP and JBP applications, see the topic "Program switching in JMP and JBP applications" in the IMS Application Programming guide documentation.
buffer - the ByteBuffer object to send the messagealternatePcbName - the name of the alternate PCB to be used for an insertTMException - if the operation failsDLIExceptionApplication#get31BitDirectByteBuffer(int)},
ByteBuffer.allocateDirect(int)void insert(java.nio.ByteBuffer buffer,
java.lang.String alternatePcbName,
java.lang.String modName)
throws DLIException
DLIExceptionvoid change(java.lang.String destinationName,
java.lang.String altPCBName)
throws DLIException
destinationName - The name of the destination to change toaltPCBName - DLIExceptionvoid purge(java.lang.String alternatePcbName)
throws DLIException
alternatePcbName - java.lang.ExceptionDLIExceptionvoid purge(java.lang.String alternatePcbName,
IOMessage message)
throws DLIException
alternatePcbName - message - java.lang.ExceptionDLIExceptionvoid purge(java.lang.String alternatePcbName,
IOMessage message,
java.lang.String modName)
throws DLIException
alternatePcbName - message - modName - DLIExceptionAIB getAIB()
AIB instance associated with the most recent DL/I call.
The AIB contains all the data attributes of the IMS application interface block.AIB instance associated with the most recent DL/I call.