public abstract class InlineBusTopicSink extends BusTopicBase implements BusTopicSink
Topic.CommInfrastructure
Modifier and Type | Field and Description |
---|---|
protected boolean |
alive
Am I running?
reflects invocation of start()/stop()
!locked & start() => alive
stop() => !alive
|
protected boolean |
locked
Am I locked?
reflects invocation of lock()/unlock() operations
locked => !alive (but not in the other direction necessarily)
locked => !offer, !run, !start, !stop (but this last one is obvious
since locked => !alive)
|
protected static org.apache.log4j.Logger |
networkLogger
Not to be converted to PolicyLogger.
|
protected String |
partitionId
The partition key to publish to
|
protected BusPublisher |
publisher
message bus publisher
|
apiKey, apiSecret, recentEvents, servers, topic
DEFAULT_LOG_SEND_FAILURES_AFTER
NETWORK_LOGGER
Constructor and Description |
---|
InlineBusTopicSink(List<String> servers,
String topic,
String apiKey,
String apiSecret,
String partitionId)
constructor for abstract sink
|
Modifier and Type | Method and Description |
---|---|
String |
getPartitionKey()
return the partition key in used by the system to publish messages
|
abstract Topic.CommInfrastructure |
getTopicCommInfrastructure()
gets the communication infrastructure type
|
abstract void |
init()
Initialize the Bus publisher
|
boolean |
isAlive() |
boolean |
isLocked() |
boolean |
lock() |
boolean |
send(String message)
Sends a string message over this Topic Endpoint
|
void |
setPartitionKey(String partitionKey)
Sets the UEB partition key for published messages
|
void |
shutdown() |
boolean |
start() |
boolean |
stop() |
boolean |
unlock() |
getApiKey, getApiSecret, getRecentEvents, getServers, getTopic, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getApiKey, getApiSecret
getRecentEvents, getServers, getTopic
protected static final org.apache.log4j.Logger networkLogger
protected String partitionId
protected volatile boolean alive
protected volatile boolean locked
protected BusPublisher publisher
public InlineBusTopicSink(List<String> servers, String topic, String apiKey, String apiSecret, String partitionId) throws IllegalArgumentException
servers
- serverstopic
- topicapiKey
- api secretapiSecret
- api secretpartitionId
- partition idIllegalArgumentException
- in invalid parameters are passed inpublic abstract void init()
public boolean start() throws IllegalStateException
start
in interface org.openecomp.policy.drools.properties.Startable
IllegalStateException
public boolean stop()
stop
in interface org.openecomp.policy.drools.properties.Startable
public boolean lock()
lock
in interface org.openecomp.policy.drools.properties.Lockable
public boolean unlock()
unlock
in interface org.openecomp.policy.drools.properties.Lockable
public boolean isLocked()
isLocked
in interface org.openecomp.policy.drools.properties.Lockable
public boolean isAlive()
isAlive
in interface org.openecomp.policy.drools.properties.Startable
public boolean send(String message) throws IllegalArgumentException, IllegalStateException
send
in interface TopicSink
message
- message to sendIllegalArgumentException
- an invalid message has been providedIllegalStateException
- the entity is in an state that prevents
it from sending messages, for example, locked or stopped.public void setPartitionKey(String partitionKey)
setPartitionKey
in interface BusTopicSink
partitionKey
- the partition keypublic String getPartitionKey()
getPartitionKey
in interface BusTopicSink
public void shutdown() throws IllegalStateException
shutdown
in interface org.openecomp.policy.drools.properties.Startable
IllegalStateException
public abstract Topic.CommInfrastructure getTopicCommInfrastructure()
getTopicCommInfrastructure
in interface Topic
Copyright © 2018. All rights reserved.