public abstract class RPCService extends BrokerService
Modifier and Type | Field and Description |
---|---|
static int |
RELIABLE_AUTO_COMMIT
RELIABLE_AUTO_COMMIT = 1
|
static int |
RELIABLE_CLIENT_COMMIT
RELIABLE_CLIENT_COMMIT = 2
|
static int |
RELIABLE_OFF
RELIABLE_OFF = 0
|
static int |
RPC_MAX_VERSION
Highest version supported, always 4 digits.
|
static java.lang.String |
RPC_MAX_VERSION_STRING |
DEFAULT_WAITTIME
Modifier | Constructor and Description |
---|---|
protected |
RPCService()
Creates an RPCService object without parameters.
|
protected |
RPCService(BrokerService brokerService,
java.lang.String libName,
boolean compress)
Creates an RPCService object.
|
protected |
RPCService(Broker broker,
java.lang.String serverAddr,
java.lang.String libName)
Creates an RPCService object.
|
protected |
RPCService(Broker broker,
java.lang.String serverAddr,
java.lang.String libName,
boolean compress)
Creates an RPCService object.
|
Modifier and Type | Method and Description |
---|---|
void |
closeConversation()
Closes the running RPC conversation.
|
void |
closeConversationCommit()
Closes the running RPC conversation.
|
boolean |
getCompression()
Returns the current setting for compression.
|
protected Conversation |
getConversation()
Returns the Conversation object.
|
java.lang.String |
getLibraryName()
Returns the current value of the library name used by the RPC.
|
java.lang.String |
getMessageID()
Gets the message id (valid for reliable RPC).
|
boolean |
getNaturalLogon()
Returns the current setting for logon to Natural Security for Natural
RPC servers.
|
java.lang.String |
getProgramName()
Returns the current value of the RPC subprogram name.
|
int |
getReliable()
Gets the mode for reliable RPC.
|
java.lang.String |
getRPCPassword()
Gets the RPC password (used with NATURAL logon).
|
java.lang.String |
getRPCUserId()
Returns the user ID which is used by the RPCs.
|
java.lang.String |
getStatusOfMessage(java.lang.String messageID)
Gets the status of the message identified by the message id (valid for
reliable RPC).
|
protected void |
onEnter(java.lang.String progname)
User exit method called at the beginning of a generated method.
|
protected void |
onException(java.lang.String progname,
BrokerException exception)
User exit method called when an exception which is an instance of
BrokerException is thrown in the generated method. |
protected void |
onLeave(java.lang.String progname,
int sendLength,
int receiveLength)
User exit method called at the end of a generated method.
|
protected boolean |
onRetry(java.lang.String progname,
BrokerException exception)
User exit method called when an exception which is an instance of
BrokerException is thrown in the generated method. |
java.lang.String |
ping()
Sends an RPC PING command to the service and returns the response string.
|
void |
reliableCommit()
Commit a transaction (unit of work) for reliable RPC.
|
void |
reliableRollback()
Roll back a transaction (unit of work) for reliable RPC.
|
void |
setBroker(Broker broker)
Dynamically assigns the instance of a Broker object.
|
void |
setCompression(boolean rpcCompression)
Switches RPC compression ON or OFF.
|
void |
setConversation(Conversation conversation)
Enables conversational RPC.
|
void |
setLibraryName(java.lang.String libName)
Changes the library name used by the RPC.
|
void |
setNaturalLogon(boolean logon)
Enables or disables logon to Natural Security for Natural RPC servers.
|
void |
setReliable(int mode)
Sets reliable RPC mode.
|
void |
setRpcLibrary(java.lang.String libraryName1)
Sets the RPC library name which is send to the broker with the RPCLIB
keyword.
|
void |
setRPCPassword(java.lang.String password1)
Changes the password used for an RPC.
|
void |
setRpcProgram(java.lang.String programName)
Sets the RPC program name which is send to the broker with the RPCPGM
keyword.
|
void |
setRPCUserId(java.lang.String userId1)
Changes the user ID used for an RPC call.
|
void |
setServerAddress(java.lang.String serverAddress)
Dynamically assigns the server address.
|
cancelallConversations, deregister, deregisterImmediate, endallConversations, getBroker, getCharacterEncoding, getDefaultWaittime, getEnvironment, getMaxReceiveLen, getServerClass, getServerName, getServiceName, isGeneric, receive, receive, receiveAny, receiveAttachInfo, receiveOld, register, registerAttach, replyError, send, sendReceive, sendReceive, setAdjustReceiveLen, setDefaultWaittime, setEnvironment, setMaxReceiveLen, toString, useCodePage, useCodePage
public static final int RELIABLE_OFF
public static final int RELIABLE_AUTO_COMMIT
public static final int RELIABLE_CLIENT_COMMIT
public static final int RPC_MAX_VERSION
public static final java.lang.String RPC_MAX_VERSION_STRING
protected RPCService(Broker broker, java.lang.String serverAddr, java.lang.String libName, boolean compress)
broker
- A Broker instance.serverAddr
- The server address (class/name/service).libName
- The default library name.compress
- Compression ON/OFF.protected RPCService(BrokerService brokerService, java.lang.String libName, boolean compress)
brokerService
- A BrokerService instance.libName
- The default library name.compress
- Compression ON/OFF.protected RPCService(Broker broker, java.lang.String serverAddr, java.lang.String libName)
broker
- A Broker instance.serverAddr
- The server address (class/name/service).libName
- The default library name.protected RPCService()
public final void setRPCUserId(java.lang.String userId1)
userId1
- The new user ID.public final java.lang.String getRPCUserId()
public final void setRPCPassword(java.lang.String password1)
logon
method. At the moment this is only used by Natural RPC servers
running with Natural Security.password1
- The new Password.public final java.lang.String getRPCPassword()
public final void setBroker(Broker broker) throws BrokerException
broker
- A Broker instance.BrokerException
- A BrokerException.public final void setServerAddress(java.lang.String serverAddress) throws BrokerException
serverAddress
- The server address (class/name/service).BrokerException
- if called in a conversational RPC sequence.public final void setLibraryName(java.lang.String libName)
libName
- The new library name (maximum 8 characters).public java.lang.String getLibraryName()
public java.lang.String getProgramName()
public final void setNaturalLogon(boolean logon)
logon
- true
to enable, false
to disable.public final boolean getNaturalLogon()
true
if enabled, false
if disabled.public final void setCompression(boolean rpcCompression)
rpcCompression
- true
if ON, false
if OFF.public final boolean getCompression()
true
if ON, false
if OFF.public final void setRpcProgram(java.lang.String programName)
programName
- the program name.public final void setRpcLibrary(java.lang.String libraryName1)
libraryName1
- the library name.public final void setConversation(Conversation conversation)
conversation
- A non-null Conversation object.java.lang.IllegalArgumentException
- Thrown if no conversation is specified.java.lang.IllegalStateException
- if this service is already used for reliable RPC.protected final Conversation getConversation()
public final void closeConversation() throws BrokerException
BrokerException
- A BrokerException.public final void closeConversationCommit() throws BrokerException
BrokerException
- A BrokerException.public final void reliableCommit() throws BrokerException
BrokerException
- if the broker call to commit the messages fails.public final void reliableRollback() throws BrokerException
BrokerException
- if the broker call to commit the messages fails.public final java.lang.String getMessageID()
reliableCommit()
or reliableRollback()
in
RELIABLE_CLIENT_COMMIT
mode and after sending a message in
RELIABLE_AUTO_COMMIT
mode.public final java.lang.String getStatusOfMessage(java.lang.String messageID) throws BrokerException
messageID
- the message id obtained by a previous call of
getMessageID()
.BrokerException
- if the Broker call fails.protected void onEnter(java.lang.String progname) throws BrokerException
progname
- The RPC program name.BrokerException
- A BrokerException.protected void onLeave(java.lang.String progname, int sendLength, int receiveLength) throws BrokerException
progname
- The RPC program name.sendLength
- length of send bufferreceiveLength
- length of receive bufferBrokerException
- A BrokerException.protected void onException(java.lang.String progname, BrokerException exception) throws BrokerException
BrokerException
is thrown in the generated method.
After calling this method the exception is thrown again. There
is no need to throw the exception in the implementation of this method.
This method has a default implementation and can be overriden in the
Java Wrapper Customization class.progname
- The RPC program name.exception
- reference to the exception, which is thrown in the
generated method.BrokerException
- A BrokerException.protected boolean onRetry(java.lang.String progname, BrokerException exception) throws BrokerException
BrokerException
is thrown in the generated method.
This method is only called when the exception is thrown during the
processing of the RPC. If this method returns false
, the
exception will be thrown again and the onException
method
is called. If this method returns true
, the RPC will be
executed once again. If the second RPC fails, onException
will be called immediately. This method has a default implementation
and can be overridden in the Java Wrapper Customization class.progname
- The RPC program name.exception
- reference to the exception which is thrown in the
generated method.BrokerException
- A BrokerException.public java.lang.String ping() throws BrokerException
BrokerException
- if a Broker error occurs.public final int getReliable()
RELIABLE_OFF
, RELIABLE_AUTO_COMMIT
,
RELIABLE_CLIENT_COMMIT
.public final void setReliable(int mode)
RELIABLE_OFF
,
RELIABLE_AUTO_COMMIT
, RELIABLE_CLIENT_COMMIT
.mode
- the reliable RPC mode to setjava.lang.IllegalStateException
- if this service is already used for reliable RPC.