Package com.attivio.client
Class AbstractReceiverClient
- java.lang.Object
-
- com.attivio.client.AbstractReceiverClient
-
- Direct Known Subclasses:
MessageForwardingClient
public abstract class AbstractReceiverClient extends java.lang.Object
Serves as the base class for all client implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AbstractReceiverClient.ClientMessageSender
-
Field Summary
Fields Modifier and Type Field Description protected AttivioLogger
log
Logger for all implementations.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractReceiverClient(java.lang.String receiverUri)
Create a client based on a specific recieverUri.protected
AbstractReceiverClient(java.util.UUID clientId, java.lang.String receiverUri)
Constructor that reuses a clientId.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearConnectionCredentials()
Clear any connection credentials set for the clientjava.util.UUID
getClientId()
WorkflowQueue
getClientWorkflow()
AbstractReceiverClient.ClientMessageSender
getMessageSender()
java.lang.String
getReceiverUri()
protected PlatformMessage
handleServerReset(PlatformMessage msg, AttivioException ae)
Called when the client has detected a server reset.protected boolean
isReceiverSSL()
Check if the receiver uri is an https connection string.protected void
sendAsyncMessage(PlatformMessage msg)
Sends an asynchronous message to Attivio via the configured nodegetReceiverUri()
.protected PlatformMessage
sendMessage(PlatformMessage msg)
Sends a synchronous message to Attivio via the configured nodegetReceiverUri()
.protected PlatformMessage
sendMessage(PlatformMessage msg, boolean allowNullResponse)
Sends a synchronous message to Attivio via the configured nodegetReceiverUri()
.void
setClientWorkflow(WorkflowQueue clientWorkflow)
Sets the default client workflows to use for this client.void
setClientWorkflow(java.lang.String... wfs)
Sets the default client workflows to use for this client.void
setConnectionCredentials(java.lang.String username, java.lang.String password)
Sets the username and password for the transport connection if authentication is required.void
setMessageSender(AbstractReceiverClient.ClientMessageSender messageSender)
-
-
-
Field Detail
-
log
protected AttivioLogger log
Logger for all implementations.
-
-
Constructor Detail
-
AbstractReceiverClient
protected AbstractReceiverClient(java.util.UUID clientId, java.lang.String receiverUri)
Constructor that reuses a clientId.This method is for very specific use cases and should not be used for general development purposes.
-
AbstractReceiverClient
protected AbstractReceiverClient(java.lang.String receiverUri)
Create a client based on a specific recieverUri.
-
-
Method Detail
-
getClientId
public final java.util.UUID getClientId()
- Returns:
- the client id associated with this client
-
getReceiverUri
public final java.lang.String getReceiverUri()
- Returns:
- the receiver URI associated with this client
-
getClientWorkflow
public WorkflowQueue getClientWorkflow()
- Returns:
- the default client workflows to use for this client.
-
setClientWorkflow
public void setClientWorkflow(WorkflowQueue clientWorkflow)
Sets the default client workflows to use for this client. All future requests not explicitly setting a WorkflowQueue will use the default.- Parameters:
clientWorkflow
- workflow queue name
-
setClientWorkflow
public void setClientWorkflow(java.lang.String... wfs)
Sets the default client workflows to use for this client. All future requests not explicitly setting a WorkflowQueue will use the default.- Parameters:
wfs
- list of workflow names
-
setConnectionCredentials
public void setConnectionCredentials(java.lang.String username, java.lang.String password)
Sets the username and password for the transport connection if authentication is required.- Parameters:
username
- user namepassword
- password
-
isReceiverSSL
protected boolean isReceiverSSL()
Check if the receiver uri is an https connection string.
-
clearConnectionCredentials
public void clearConnectionCredentials()
Clear any connection credentials set for the client
-
sendMessage
protected PlatformMessage sendMessage(PlatformMessage msg) throws AttivioException
Sends a synchronous message to Attivio via the configured nodegetReceiverUri()
.If the receiver uri is a local in-memory queue, ClassNotFoundExceptions will occur if the full Attivio jars are not available.
- Parameters:
msg
- the message to send- Returns:
- the response message
- Throws:
AttivioException
-
sendMessage
protected PlatformMessage sendMessage(PlatformMessage msg, boolean allowNullResponse) throws AttivioException
Sends a synchronous message to Attivio via the configured nodegetReceiverUri()
.If the receiver uri is a local in-memory queue, ClassNotFoundExceptions will occur if the full Attivio jars are not available.
- Parameters:
msg
- the message to sendallowNullResponse
- if true, null response is acceptable- Returns:
- the response message
- Throws:
AttivioException
-
handleServerReset
protected PlatformMessage handleServerReset(PlatformMessage msg, AttivioException ae) throws AttivioException
Called when the client has detected a server reset. The default behavior is for the client to reset the message ids in use and continue. If the desire is to halt client-side processing in the case of a server reset, this method may be overridden to throw the supplied (ae
) exception.- Parameters:
msg
- the message being sentae
- the exception generated by the server- Returns:
- the msg that should be sent instead of the original
- Throws:
AttivioException
-
sendAsyncMessage
protected void sendAsyncMessage(PlatformMessage msg) throws AttivioException
Sends an asynchronous message to Attivio via the configured nodegetReceiverUri()
. If the receiver uri is a local in-memory queue, ClassNotFoundExceptions will occur if the full Attivio jars are not available.- Parameters:
msg
- the message to send- Throws:
AttivioException
-
getMessageSender
public AbstractReceiverClient.ClientMessageSender getMessageSender()
-
setMessageSender
public void setMessageSender(AbstractReceiverClient.ClientMessageSender messageSender)
-
-