public class BrokerService
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_WAITTIME
The initial default wait time used in the sendReceive() method call and
all receive() method calls.
|
Constructor and Description |
---|
BrokerService(Broker broker,
java.lang.String serverAddr)
Creates a new BrokerService object.
|
BrokerService(Broker broker,
java.lang.String serverClass,
java.lang.String serverName,
java.lang.String serviceName)
Creates a new BrokerService object.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelallConversations()
Cancels all conversations for this service.
|
void |
deregister()
Deregisters a registered BrokerService object from the EntireX Broker.
|
void |
deregisterImmediate()
Deregisters a registered BrokerService object from the EntireX Broker.
|
void |
endallConversations()
Ends all conversations for this service.
|
Broker |
getBroker()
Returns the Broker object to which the service belongs.
|
java.lang.String |
getCharacterEncoding()
Gets the character encoding name or
null . |
java.nio.charset.Charset |
getCharset()
Gets the Charset used for this service.
|
java.lang.String |
getDefaultWaittime()
Returns the default wait time.
|
int |
getMaxReceiveLen()
Returns the current maximum receive length.
|
java.lang.String |
getServerClass()
Returns the server class.
|
java.lang.String |
getServerName()
Returns the server name.
|
java.lang.String |
getServiceName()
Returns the service name.
|
boolean |
isGeneric()
Returns an indication whether this is a generic service.
|
BrokerMessage |
receive()
Receives an incoming request or message.
|
BrokerMessage |
receive(java.lang.String wait)
Receives an incoming request or message.
|
BrokerMessage |
receiveAny()
Receives an incoming request or message.
|
BrokerAttachInfo |
receiveAttachInfo()
Receives for attach servers a notification about waiting clients.
|
BrokerMessage |
receiveOld()
Receives an incoming request or message.
|
void |
register()
Registers a BrokerService with the EntireX Broker.
|
void |
registerAttach()
Registers a Broker Attach Server with the EntireX Broker.
|
boolean |
replyError(java.lang.String errorCode,
java.lang.String errorText)
Sends a reply with an error code to the Broker.
|
void |
send(BrokerMessage msg)
Sends an asynchronous non-conversational message.
|
BrokerMessage |
sendReceive(BrokerMessage msg)
Sends a synchronous non-conversational message.
|
BrokerMessage |
sendReceive(BrokerMessage msg,
java.lang.String wait)
Sends a synchronous non-conversational message.
|
void |
setCharacterEncoding(java.lang.String enc)
Sets the character encoding for the payload encoding.
|
void |
setDefaultWaittime(java.lang.String wait)
Sets the value of the default wait time field to the argument.
|
void |
setMaxReceiveLen(int len)
Sets the current maximum receive length.
|
java.lang.String |
toString()
Overrides the toString() method of Object.
|
public static final java.lang.String DEFAULT_WAITTIME
setDefaultWaittime(java.lang.String)
,
Constant Field Valuespublic BrokerService(Broker broker, java.lang.String serverAddr)
broker
- An instance of a Broker object.serverAddr
- The address of the server in the form "serverClass/serverName/serviceName".java.lang.IllegalArgumentException
- Thrown if a parameter is invalid.DEFAULT_WAITTIME
public BrokerService(Broker broker, java.lang.String serverClass, java.lang.String serverName, java.lang.String serviceName)
broker
- An instance of a Broker object.serverClass
- The name of the server class.serverName
- The name of the server.serviceName
- The name of the service.java.lang.IllegalArgumentException
- Thrown if a parameter is invalid.DEFAULT_WAITTIME
public Broker getBroker()
public final java.lang.String toString()
toString
in class java.lang.Object
public final java.lang.String getServerName()
public final java.lang.String getServerClass()
public final java.lang.String getServiceName()
public final java.lang.String getDefaultWaittime()
DEFAULT_WAITTIME
public final void setDefaultWaittime(java.lang.String wait)
wait
- The new value of the default wait time. Allowed values are
NO
No wait time. Control is returned to the
caller immediately.
nS
The number of seconds the caller will wait
for a reply.
nM
The number of minutes the caller will wait
for a reply.
nH
The number of hours the caller will wait
for a reply.
n
has to be smaller than
100000 and not negative. Setting an illegal value results in
an IllegalArgumentException
on send
,
sendReceive
, or receive
. The value
'YES', specified in the general documentation of the broker
ACI fields is illegal for Java components.DEFAULT_WAITTIME
public final int getMaxReceiveLen()
public final void setMaxReceiveLen(int len)
receive
or sendReceive
method can receive.
If the returned data is longer than the current maximum receive length,
the data is truncated and a BrokerException with
errorclass=20 and errorcode=94 is thrown.
len
- The new receive length in bytes.public final boolean isGeneric()
register
, registerAttach
, and
send
calls are not allowed with generic services.true
if this is a generic Service,
false
otherwise.public final void register() throws BrokerException
BrokerException
- A Broker exception.public final void registerAttach() throws BrokerException
BrokerException
- A Broker exception.receiveAttachInfo()
public final void deregister() throws BrokerException
BrokerException
- A Broker exception.public final void deregisterImmediate() throws BrokerException
BrokerException
- A Broker exception.public final void send(BrokerMessage msg) throws BrokerException
msg
- BrokerMessage to send.BrokerException
- A Broker exception.java.lang.IllegalArgumentException
- Thrown if no message is specified.sendReceive(BrokerMessage, java.lang.String)
public final BrokerMessage sendReceive(BrokerMessage msg) throws BrokerException
msg
- BrokerMessage to send.BrokerException
- A Broker exception.send(com.softwareag.entirex.aci.BrokerMessage)
public final BrokerMessage sendReceive(BrokerMessage msg, java.lang.String wait) throws BrokerException
msg
- BrokerMessage to send.wait
- A timeout period, how long to wait for an immediate reply,
measured in seconds/minutes/hours (depending on the trailing
S/M/H character). The value 'YES', specified in the general
documentation of the broker ACI fields is not allowed for Java
components.BrokerException
- A Broker exception.java.lang.IllegalArgumentException
- Thrown if no message is specified or parameter is invalid.send(com.softwareag.entirex.aci.BrokerMessage)
public final BrokerMessage receive() throws BrokerException
BrokerException
- A Broker exception.public final BrokerMessage receive(java.lang.String wait) throws BrokerException
wait
- A timeout period, how long to wait for a receive, measured in
seconds/minutes/hours (depending on the trailing S/M/H
character). When null or 'NO' is specified, the operation is
non-blocked. If no message is available, a Broker Exception
with errorclass=74 and errorcode=74 is thrown. The value 'YES'
is illegal.BrokerException
- A Broker exception.java.lang.IllegalArgumentException
- Thrown if parameter is invalid.public final BrokerMessage receiveOld() throws BrokerException
BrokerException
- A Broker exception.public final BrokerMessage receiveAny() throws BrokerException
BrokerException
- A Broker exception.public final boolean replyError(java.lang.String errorCode, java.lang.String errorText) throws BrokerException
errorCode
- the error code (must be 8 characters long).errorText
- the error text.true
if the reply is sent and the Broker supports
this call.
false
if the current conversation is cancelled.
This is the way to signal an error for Brokers which do not
support the function REPLYERROR. In this case
errorCode
and errorText
are
ignored.BrokerException
- if the Broker replies with an error code or this service is
an attach service or a generic service.java.lang.IllegalArgumentException
- if no message is specified.public final void endallConversations() throws BrokerException
BrokerException
- if the Broker replies with an error code.public final void cancelallConversations() throws BrokerException
BrokerException
- A Broker exception.public final BrokerAttachInfo receiveAttachInfo() throws BrokerException
BrokerException
- A Broker exception.registerAttach()
public void setCharacterEncoding(java.lang.String enc) throws BrokerException
enc
- the name of the character encoding.BrokerException
- if setting the character encoding support fails.public java.lang.String getCharacterEncoding()
null
.public java.nio.charset.Charset getCharset()