Package com.attivio.client
Class AbstractReceiverClient
- java.lang.Object
-
- com.attivio.client.AbstractReceiverClient
-
- Direct Known Subclasses:
MessageForwardingClient
public abstract class AbstractReceiverClient extends java.lang.ObjectServes as the base class for all client implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractReceiverClient.ClientMessageSender
-
Field Summary
Fields Modifier and Type Field Description protected AttivioLoggerlogLogger for all implementations.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractReceiverClient(java.lang.String receiverUri)Create a client based on a specific recieverUri.protectedAbstractReceiverClient(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 voidclearConnectionCredentials()Clear any connection credentials set for the clientjava.util.UUIDgetClientId()WorkflowQueuegetClientWorkflow()AbstractReceiverClient.ClientMessageSendergetMessageSender()java.lang.StringgetReceiverUri()protected PlatformMessagehandleServerReset(PlatformMessage msg, AttivioException ae)Called when the client has detected a server reset.protected booleanisReceiverSSL()Check if the receiver uri is an https connection string.protected voidsendAsyncMessage(PlatformMessage msg)Sends an asynchronous message to Attivio via the configured nodegetReceiverUri().protected PlatformMessagesendMessage(PlatformMessage msg)Sends a synchronous message to Attivio via the configured nodegetReceiverUri().protected PlatformMessagesendMessage(PlatformMessage msg, boolean allowNullResponse)Sends a synchronous message to Attivio via the configured nodegetReceiverUri().voidsetClientWorkflow(WorkflowQueue clientWorkflow)Sets the default client workflows to use for this client.voidsetClientWorkflow(java.lang.String... wfs)Sets the default client workflows to use for this client.voidsetConnectionCredentials(java.lang.String username, java.lang.String password)Sets the username and password for the transport connection if authentication is required.voidsetMessageSender(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)
-
-