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 |
| Modifier and Type | Method and Description |
|---|---|
void |
change(String destinationName,
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(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(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(ByteBuffer buffer)
Send an output message to IMS.
|
void |
insert(ByteBuffer buffer,
MessageDestinationSpec mds)
Send an output message to IMS.
|
void |
insert(ByteBuffer buffer,
String alternatePcbName)
Send an output message to IMS.
|
void |
insert(ByteBuffer buffer,
String alternatePcbName,
String modName) |
void |
insert(IOMessage message,
MessageDestinationSpec mds)
Send an output message to IMS.
|
static final MessageDestinationSpec DEFAULT_DESTINATION
boolean getUnique(IOMessage message) throws DLIException
message - the IOMessage object to receive the messagecom.ibm.ims.dli.tm.TMException - if the operation failsDLIExceptionboolean getUnique(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 messagecom.ibm.ims.dli.tm.TMException - 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
messagescom.ibm.ims.dli.tm.TMException - if the operation failsDLIExceptionboolean getNext(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
messagescom.ibm.ims.dli.tm.TMException - 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 tocom.ibm.ims.dli.tm.TMException - if the operation failsDLIExceptionvoid insert(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 messagecom.ibm.ims.dli.tm.TMException - if the operation failsDLIExceptionApplication#get31BitDirectByteBuffer(int)},
ByteBuffer.allocateDirect(int)void insert(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 tocom.ibm.ims.dli.tm.TMException - if the operation failsDLIExceptionApplication#get31BitDirectByteBuffer(int)},
ByteBuffer.allocateDirect(int)void insert(ByteBuffer buffer, 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 insertcom.ibm.ims.dli.tm.TMException - if the operation failsDLIExceptionApplication#get31BitDirectByteBuffer(int)},
ByteBuffer.allocateDirect(int)void insert(ByteBuffer buffer, String alternatePcbName, String modName) throws DLIException
DLIExceptionvoid change(String destinationName, String altPCBName) throws DLIException
destinationName - The name of the destination to change toaltPCBName - 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.(c) Copyright IBM Corporation 2008, 2017.