public class ProducerFacade
extends java.lang.Object
Constructor and Description |
---|
ProducerFacade() |
Modifier and Type | Method and Description |
---|---|
static BytesMessage |
createBytesMessage(java.lang.String aliasName)
Returns a BytesMessage object that can then be sent to the JMS provider.
|
static MapMessage |
createMapMessage(java.lang.String aliasName)
Returns a MapMessage object that can then be sent to the JMS provider.
|
static ObjectMessage |
createObjectMessage(java.lang.String aliasName)
Returns an
ObjectMessage object that can then be sent to a
Destination on the JMS provider. |
static StreamMessage |
createStreamMessage(java.lang.String aliasName)
Returns a
StreamMessage object that can then be sent to
the JMS provider. |
static TextMessage |
createTextMessage(java.lang.String aliasName)
Returns a
TextMessage object that can then be sent to a
destination on the JMS provider. |
static IData |
send(java.lang.String aliasName,
java.lang.String destinationName,
int destinationType,
IData header,
IData properties,
IData body,
boolean useCSQ)
Sends a message to the JMS provider.
|
static IData |
sendAndWait(java.lang.String aliasName,
java.lang.String destinationName,
int destinationType,
java.lang.String destinationNameReplyTo,
int destinationTypeReplyTo,
long waitTime,
IData header,
IData properties,
IData body,
boolean useCSQ)
Sends a message to the JMS provider and optionally, waits for a reply.
|
static void |
sendLargeMessageStream(java.lang.String aliasName,
java.lang.String destinationName,
int destinationType,
java.io.InputStream inputStream)
Deprecated.
No replacement. webMethods Broker is deprecated,
which results in the deprecation of this method.
|
static IData |
sendReplyFromOnDemandConsumer(IData header,
IData properties,
IData body,
OnDemandConsumer consumer,
Message originalMessage)
Sends a reply message in response to a request message received by an
OnDemandConsumer.
|
static IData |
sendReplyFromTrigger(IData header,
IData properties,
IData body)
Sends a reply message in response to a request message received and
processed by a JMS trigger.
|
static IData |
waitForReply(java.lang.String correlationID,
long waitTime)
Waits for a reply sent in response to an asynchronous request.
|
public static TextMessage createTextMessage(java.lang.String aliasName) throws JMSException, JMSSubsystemException, ResourceUnavailableException
TextMessage
object that can then be sent to a
destination on the JMS provider.aliasName
- a String containing the name of the JMS connection alias that
you want to use to send the messageJMSException
- if the JMS provider fails to create this message due to some
internal errorJMSSubsystemException
- if the specified aliasName does not exist or if another error
occurs within the JMS subsystemResourceUnavailableException
- if the JMS provider specified in the JMS connection alias is
not availablejavax.jms.Session#createTextMessage()
public static ObjectMessage createObjectMessage(java.lang.String aliasName) throws JMSException, JMSSubsystemException, ResourceUnavailableException
ObjectMessage
object that can then be sent to a
Destination on the JMS provider.aliasName
- a String containing the name of the JMS connection alias that
you want to use to send the messageJMSException
- if the JMS provider fails to create this message due to some
internal errorJMSSubsystemException
- if the specified aliasName does not exist or if another error
occurs within the JMS subsystemResourceUnavaiableException
- if the JMS provider specified in the JMS connection alias is
not availableResourceUnavailableException
javax.jms.Session#createObjectMessage()
public static StreamMessage createStreamMessage(java.lang.String aliasName) throws JMSException, JMSSubsystemException, ResourceUnavailableException
StreamMessage
object that can then be sent to
the JMS provider.aliasName
- a String specifying the JMS connection alias that you want to
use to send the JMS message.JMSException
- if the JMS provider fails to create this message due to some
internal errorJMSSubsystemException
- if the specified aliasName does not exist or if another error
occurs within the JMS subsystemResourceUnavailableException
- if the JMS provider specified in the JMS connection alias is
not availablejavax.jms.Session#createStreamMessage()
public static MapMessage createMapMessage(java.lang.String aliasName) throws JMSException, JMSSubsystemException, ResourceUnavailableException
aliasName
- a String that specifies the JMS connection alias that you want
to use to send the JMS message.MapMessage
objectJMSException
- if the JMS provider fails to create this message due to some
internal errorJMSSubsystemException
- if the specified aliasName does not exist or if another error
occurs within the JMS subsystemResourceUnavailableException
- if the JMS provider specified in the JMS connection alias is
not availablejavax.jms.Session#createMapMessage()
public static BytesMessage createBytesMessage(java.lang.String aliasName) throws JMSException, JMSSubsystemException, ResourceUnavailableException
aliasName
- a String that specifies the JMS connection alias that you want
to use to send the JMS message.BytesMessage
objectJMSException
- if the JMS provider fails to create this message due to some
internal errorJMSSubsystemException
- if the specified aliasName does not exist or if another error
occurs within the JMS subsystemResourceUnavailableException
- if the JMS provider specified in the JMS connection alias is
not available
*javax.jms.Session#createBytesMessage()
public static IData send(java.lang.String aliasName, java.lang.String destinationName, int destinationType, IData header, IData properties, IData body, boolean useCSQ) throws JMSSubsystemException, ResourceUnavailableException
Returns an IData containing the JMS message sent to the JMS provider. Some of the header fields in a JMS message are populated by the JMS provider after the message is sent. For example, the header field JMSMessageID is not in the JMS message sent by Integration Server, but JMSMessageID is in the header after the JMS provider receives the message.
aliasName
- a String for JMS connection alias that you want to use to send
the messagedestinationName
- a String for Name or lookup name of the Destination to which
you want to send the message. Specify the lookup name of the
Destination object when the JMS connection alias uses JNDI to
retrieve administered objects. Specify the provider-specific
name of the Destination when the JMS connection alias uses the
native webMethods API to connect directly to the webMethods
JMS Provider.destinationType
- an int indicating whether the destination is a queue or topic;
Queue = 0; Topic = 1header
- an IData containing the header for the JMS messageproperties
- an IData containing the properties for the JMS messagebody
- an IData containing the body of the JMS messageuseCSQ
- a boolean indicating whether or not Integration Server places
messages in the client side queue if the JMS provider is not
available at the time this method is called. True to use the
client side queue; otherwise false. Note that if aliasName
specifies a transacted JMS connection alias, useCSQ must be
set to false. Messages sent as part of a transaction cannot be
written to the client side queue.JMSSubsystemException
- if an error occurs within the JMS subsystem, for example: if
an aliasName is not provided; if a destinationName is not
provided; if the specified aliasName is for a transacted JMS
connection alias and useCSQ is set to true; if the specified
JMS connection alias is not configured to use a client side
queue and useCSQ is set to true; if Integration Server is
unable to write the message to the client side queue; if
Integration Server is unable to send the message to the JMS
providerResourceUnavailableException
- if the JMS provider is not available when this method is
called and useCSQ is set to falsepublic static void sendLargeMessageStream(java.lang.String aliasName, java.lang.String destinationName, int destinationType, java.io.InputStream inputStream) throws JMSSubsystemException, ResourceUnavailableException
This method allows you to stream large amounts of data or a large file from a message producer to a message consumer. You can only send and receive large messages from Integration Server when working with the webMethods Broker.
Large message streams cannot be sent or received as part of a transaction.
If the connection between Integration Server and the webMethods JMS Provider fails before this method sends the entire message stream, you need to re-send the entire stream when the connection is re-established.
aliasName
- a String for the JMS connection alias that you want to use to
send the messagedestinationName
- a String for the name of the destination to which you want to
send the messagedestinationType
- an int indicating whether the destination is a queue or topic;
Queue = 0; Topic = 1inputStream
- an InputStream
object for the message stream
you want to sendJMSSubsystemException
- if an error occurs within the JMS subsystem, for example: if
the required parameters aliasName, destinationName, or
inputStream are not provided; if the specified JMS connection
alias has a transaction type of LOCAL_TRANSACTION or
XA_TRANSACTIONResourceUnavailableException
- if the webMethods Broker is not available when this
method is called; if the connection to the webMethods JMS
Provider fails before the entire message stream is sentpublic static IData sendAndWait(java.lang.String aliasName, java.lang.String destinationName, int destinationType, java.lang.String destinationNameReplyTo, int destinationTypeReplyTo, long waitTime, IData header, IData properties, IData body, boolean useCSQ) throws JMSSubsystemException, ResourceUnavailableException
Returns an IData containing the JMS message sent to the JMS provider. Some of the header fields in a JMS message are populated by the JMS provider after the message is sent. For example, the header field JMSMessageID is not in the JMS message sent by Integration Server, but JMSMessageID is in the header after the JMS provider receives the message.
This method can initiate a request/reply in a synchronous or asynchronous manner.
In a synchronous request/reply, this method waits for a reply before
continuing. In an asynchronous request/reply, this method that sends the
request continues after sending the message. To retrieve the reply, call
one of the waitForReply
method. A waitTime < 1 indicates
the request/reply is asynchronous.
The replying message consumer uses the value or uuid or JMSMessageID in the requesting JMS message to correlate the request and the response. If you specify the uuid when sending the request, the replying Integration Server will use the uuid as the JMSCorrelationID of the reply message. If you do not specify a uuid, the replying message consumer uses the JMSMessageID set by the JMS provider as the JMSCorrelationID of the reply message.
Integration Server can write messages to the client side queue only for messages sent as part of an asynchronous request/reply. That is, if the waitTime is < 1 and the JMS provider is not available when this method is called, Integration Server places the message in the client side queue. Client side queuing cannot be used for a synchronous request/reply.
If you do not specify a destination for reply messages, Integration Server uses a temporaryQueue to receive the reply. A temporaryQueue is a queue object created for the duration of a particular connection. It can only be consumed by the connection from which it was created.
aliasName
- a String for JMS connection alias that you want to use to send
the messagedestinationName
- a String for Name or lookup name of the Destination to which
you want to send the message. Specify the lookup name of the
Destination object when the JMS connection alias uses JNDI to
retrieve administered objects. Specify the provider-specific
name of the Destination when the JMS connection alias uses the
native webMethods API to connect directly to the webMethods
JMS Provider.destinationType
- an int indicating whether the destination is a queue or topic;
Queue = 0; Topic = 1destinationNameReplyTo
- a String for the name or lookup name of the Destination to
which you want the reply message sent. Specify the lookup name
of the Destination object when the JMS connection alias uses
JNDI to retrieve administered objects. Specify the
provider-specific name of the Destination when the JMS
connection alias uses the native webMethods API to connect
directly to the webMethods Broker.destinationTypeReplyTo
- an int that indicates if the destination to which the reply to
be sent is a queue or topic; Queue = 0; Topic = 1waitTime
- a long indicating the time to wait (in milliseconds) for the
response to arrive. A waitTime < 1 indicates the request/reply
is asynchronous.header
- an IData containing the header for the JMS messageproperties
- an IData containing the properties for the JMS messagebody
- an IData containing the body of the JMS messageuseCSQ
- a boolean indicating whether or not Integration Server places
messages in the client side queue if the JMS provider is not
available at the time this method is called. True to use the
client side queue; otherwise false. Note that if aliasName
specifies a transacted JMS connection alias or waitTime is <
1, useCSQ must be set to false. Messages sent as part of a
transaction cannot be written to the client side queue.JMSSubsystemException
- if an error occurs within the JMS subsystem, for example: if
the required parameters aliasName and destinationName are not
provided; if useCSQ is set to true and the waitTime is
greater than 0 (a synchronous request reply cannot use the
client side queue); if useCSQ is set to true and the JMS
connection alias is transacted (messages sent as part of a
transaction cannot be written to the client side queue); if
the message cannot be written to the client side queue; if
the message cannot be sent to the JMS provider; if the reply
message does not specify a correlation ID; if the reply
message cannot be retrievedResourceUnavailableException
- if the JMS provider is not availablewaitForReply(String, long)
public static IData sendReplyFromTrigger(IData header, IData properties, IData body) throws JMSException, JMSSubsystemException, ResourceUnavailableException
Returns an IData containing the JMS message sent to the JMS provider. Some of the header fields in a JMS message are populated by the JMS provider after the message is sent. For example, the header field JMSMessageID is not in the JMS message sent by Integration Server, but JMSMessageID is in the header after the JMS provider receives the message.
This method obtains information about the reply to destination and correlation ID from the original message request.
To send a reply to a message received by an OnDemandConsumer
,
use sendReplyFromOnDemandConsumer(IData, IData, IData, OnDemandConsumer,
Message)
header
- an IData for the header of the reply JMS messageproperties
- an IData for the properties of the reply JMS messagebody
- an IData for the body of the reply JMS messageJMSException
- if the JMS provider fails for some internal errorJMSSubsystemException
- if an error occurs within the JMS subsystemResourceUnavailableException
- if the JMS provider is not availablesendReplyFromOnDemandConsumer(IData, IData, IData, OnDemandConsumer,
Message)
public static IData sendReplyFromOnDemandConsumer(IData header, IData properties, IData body, OnDemandConsumer consumer, Message originalMessage) throws JMSException, JMSSubsystemException, ResourceUnavailableException
Returns an IData containing the JMS message sent to the JMS provider. Some of the header fields in a JMS message are populated by the JMS provider after the message is sent. For example, the header field JMSMessageID is not in the JMS message sent by Integration Server, but JMSMessageID is in the header after the JMS provider receives the message.
To send a reply to a message received by a JMS trigger, use sendReplyFromTrigger(IData, IData, IData). *
header
- an IData for the header of the reply JMS messageproperties
- an IData for the properties of the reply JMS messagebody
- an IData for the body of the reply JMS messageconsumer
- the OnDemandConsumer
object used to receive the
request message from the JMS provider. This method uses
information from the message consumer to create a message
producer that will send the reply message. Use the built-in
service pub.jms.createConsumer to create an OnDemandConsumer.originalMessage
- a Message
object that contains the request
messageJMSException
- if the JMS provider fails for some internal errorJMSSubsystemException
- if an error occurs within the JMS subsystemResourceUnavailableException
- if the JMS provider is not availablesendReplyFromTrigger(IData, IData, IData)
public static IData waitForReply(java.lang.String correlationID, long waitTime) throws JMSSubsystemException
The replying JMS client uses the value of the JMSMesssageID in the
request message as the JMSCorrelationID. The JMSCorrelation ID associates
the reply with the original request. Consequently, use the JMSMessageID
in the IData returned by sendAndWait
method as the
correlationID for this method.
correlationID
- a String for the identifier used to associate the reply
message with the initial requestwaitTime
- a long for the time to wait (in milliseconds) for the reply to
arrive. If no value is specified, the method waits
indefinitely for a reply.JMSSubsystemException
- if an error occurs within the JMS subsystem