Class GenericClient
java.lang.Object
de.iip_ecosphere.platform.transport.spring.binder.generic.GenericClient
An generic client for a single binder instance. Typically, different binders subscribe to different
topics. The implementation uses queuing/a consumer pattern to cope with threading problems.
Partially public for testing.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCalled when a message for a topic arrives. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate GenericConfigurationprivate de.iip_ecosphere.platform.transport.connectors.TransportConnectorprivate booleanprivate static GenericClientprivate static final de.iip_ecosphere.platform.support.logging.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateClient(GenericConfiguration config) Creates the client based on a given AMQP client configuration.Returns the actual configuration.static GenericClientReturns the last instance created for this class.(package private) voidSendspayloadtotopic.voidStops the client.(package private) booleansubscribeTo(String topic, GenericClient.ArrivedCallback arrivedCallback) (package private) booleanunsubscribeFrom(String topic) Unsubscribes fromtopiciftopicis not blacklisted byGenericConfiguration.isFilteredTopic(String).
-
Field Details
-
LOGGER
private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER -
lastInstance
-
connector
private de.iip_ecosphere.platform.transport.connectors.TransportConnector connector -
globalInstance
private boolean globalInstance -
configuration
-
topics
-
-
Constructor Details
-
GenericClient
public GenericClient()Creates and registers an instance.
-
-
Method Details
-
getLastInstance
Returns the last instance created for this class. [testing]- Returns:
- the last instance
-
getConfiguration
Returns the actual configuration. [for testing]- Returns:
- the configuration, may be null
-
createClient
Creates the client based on a given AMQP client configuration.- Parameters:
config- the AMQP configuration to take the connection information from
-
stopClient
public void stopClient()Stops the client. -
subscribeTo
- Parameters:
topic- the topic to unsubscribe fromarrivedCallback- the callback to be called when a message arrived- Returns:
trueif done/successful,falseelse
-
unsubscribeFrom
Unsubscribes fromtopiciftopicis not blacklisted byGenericConfiguration.isFilteredTopic(String).- Parameters:
topic- the topic to unsubscribe from- Returns:
trueif done/successful,falseelse
-
send
Sendspayloadtotopic.- Parameters:
topic- the topic to send topayload- the payload to send
-