Class OMRSTopicConnector
- java.lang.Object
-
- org.odpi.openmetadata.frameworks.connectors.Connector
-
- org.odpi.openmetadata.frameworks.connectors.ConnectorBase
-
- org.odpi.openmetadata.repositoryservices.connectors.omrstopic.OMRSTopicConnector
-
- All Implemented Interfaces:
AuditLoggingComponent,VirtualConnectorExtension,OMRSTopic,OpenMetadataTopicListener
public class OMRSTopicConnector extends ConnectorBase implements OMRSTopic, VirtualConnectorExtension, OpenMetadataTopicListener, AuditLoggingComponent
OMRSTopicConnector provides the support for the registration of OMRSTopicListeners and the distribution of OMRS events - both inbound and outbound.The OMRSTopicConnector is a virtual connector. It uses one or more event bus connectors to interact with real event buses. These connectors are passed to it during initialization. During its operation, it acts as a go-between the event buses processing JSON payloads and internal open metadata components that expect to receive OMRS Events.
OMRSTopicConnector implements 3 interfaces:
- OMRSTopic provides the methods for OMRSTopicListeners to register with this connector.
- VirtualConnectorExtension declares this connector a virtual connector and provides the method for receiving the event bus connectors (embedded connectors).
- OpenMetadataTopicListener enables this object to register with the real event bus connectors that implement OpenMetadataTopic.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
ConnectorBase.ProtectedConnection
-
-
Field Summary
Fields Modifier and Type Field Description protected AuditLogauditLog-
Fields inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
connectedAssetProperties, connectionBean, connectionProperties, connectorInstanceId, securedProperties
-
-
Constructor Summary
Constructors Constructor Description OMRSTopicConnector()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddisconnect()Free up any resources held since the connector is no longer needed.ComponentDescriptiongetConnectorComponentDescription()Return the component description that is used by this connector in the audit log.voidinitializeEmbeddedConnectors(List<Connector> embeddedConnectors)Registers itself as a listener of any OpenMetadataTopicConnectors that are passed as embedded connectors.voidprocessEvent(String event)Receives events from the real topic, parses them into event objects and passes them on to the OMRSTopicListeners registered with this connector.voidregisterListener(OMRSTopicListener topicListener)Deprecated.voidregisterListener(OMRSTopicListener topicListener, String serviceName)Register a listener object.voidregisterListener(OMRSTopicRepositoryEventListener topicListener, String serviceName)Register a listener object.voidsendInstanceEvent(OMRSInstanceEvent instanceEvent)Set the instance event to the OMRS Topic connector if the instance event is of the permitted type.voidsendRegistryEvent(OMRSRegistryEvent registryEvent)Send the registry event to the OMRS Topic connector and manage errorsvoidsendTypeDefEvent(OMRSTypeDefEvent typeDefEvent)Send the TypeDef event to the OMRS Topic connector (providing TypeDef Events are enabled).voidsetAuditLog(AuditLog auditLog)Receive an audit log object that can be used to record audit log messages.voidsetEventProtocolLevel(OMRSEventProtocolVersion eventProtocolVersion)Set up the version of the protocol to use for events.voidstart()Indicates that the connector is completely configured and can begin processing.-
Methods inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
equals, getConnectedAssetProperties, getConnection, getConnectorInstanceId, hashCode, initialize, initializeConnectedAssetProperties, isActive, toString
-
Methods inherited from class org.odpi.openmetadata.frameworks.connectors.Connector
clearStatisticProperty, clearStatisticTimestamp, getConnectorStatistics, getStatisticCounter, getStatisticProperty, getStatisticTimestamp, incrementStatisticCounter, initializeStatisticCounter, setStatisticProperty, setStatisticTimestamp
-
-
-
-
Field Detail
-
auditLog
protected AuditLog auditLog
-
-
Method Detail
-
initializeEmbeddedConnectors
public void initializeEmbeddedConnectors(List<Connector> embeddedConnectors)
Registers itself as a listener of any OpenMetadataTopicConnectors that are passed as embedded connectors.- Specified by:
initializeEmbeddedConnectorsin interfaceVirtualConnectorExtension- Parameters:
embeddedConnectors- list of connectors
-
setAuditLog
public void setAuditLog(AuditLog auditLog)
Receive an audit log object that can be used to record audit log messages. The caller has initialized it with the correct component description and log destinations.- Specified by:
setAuditLogin interfaceAuditLoggingComponent- Parameters:
auditLog- audit log object
-
getConnectorComponentDescription
public ComponentDescription getConnectorComponentDescription()
Return the component description that is used by this connector in the audit log.- Specified by:
getConnectorComponentDescriptionin interfaceAuditLoggingComponent- Returns:
- id, name, description, wiki page URL.
-
setEventProtocolLevel
public void setEventProtocolLevel(OMRSEventProtocolVersion eventProtocolVersion)
Set up the version of the protocol to use for events.- Specified by:
setEventProtocolLevelin interfaceOMRSTopic- Parameters:
eventProtocolVersion- version enum
-
registerListener
@Deprecated public void registerListener(OMRSTopicListener topicListener)
Deprecated.Register an OMRSTopicListener object. This object will be supplied with all the OMRS events received on the topic.- Specified by:
registerListenerin interfaceOMRSTopic- Parameters:
topicListener- object implementing the OMRSTopicListener interface
-
registerListener
public void registerListener(OMRSTopicListener topicListener, String serviceName)
Register a listener object. This object will be supplied with all the events received on the topic.- Specified by:
registerListenerin interfaceOMRSTopic- Parameters:
topicListener- object implementing the OMRSTopicListener interfaceserviceName- name of the service that the listener is from
-
registerListener
public void registerListener(OMRSTopicRepositoryEventListener topicListener, String serviceName)
Register a listener object. This object will be supplied with all the events received on the topic.- Specified by:
registerListenerin interfaceOMRSTopic- Parameters:
topicListener- object implementing the OMRSTopicRepositoryEventListener interfaceserviceName- name of the service that the listener is from
-
start
public void start() throws ConnectorCheckedExceptionIndicates that the connector is completely configured and can begin processing. OMRSTopicConnector needs to pass on the start() to its embedded connectors.- Overrides:
startin classConnectorBase- Throws:
ConnectorCheckedException- there is a problem within the connector.
-
sendRegistryEvent
public void sendRegistryEvent(OMRSRegistryEvent registryEvent) throws ConnectorCheckedException
Send the registry event to the OMRS Topic connector and manage errors- Specified by:
sendRegistryEventin interfaceOMRSTopic- Parameters:
registryEvent- properties of the event to send- Throws:
ConnectorCheckedException- the connector is not able to communicate with the event bus
-
sendTypeDefEvent
public void sendTypeDefEvent(OMRSTypeDefEvent typeDefEvent) throws ConnectorCheckedException
Send the TypeDef event to the OMRS Topic connector (providing TypeDef Events are enabled).- Specified by:
sendTypeDefEventin interfaceOMRSTopic- Parameters:
typeDefEvent- properties of the event to send- Throws:
ConnectorCheckedException- the connector is not able to communicate with the event bus
-
sendInstanceEvent
public void sendInstanceEvent(OMRSInstanceEvent instanceEvent) throws ConnectorCheckedException
Set the instance event to the OMRS Topic connector if the instance event is of the permitted type.- Specified by:
sendInstanceEventin interfaceOMRSTopic- Parameters:
instanceEvent- properties of the event to send- Throws:
ConnectorCheckedException- the connector is not able to communicate with the event bus
-
processEvent
public void processEvent(String event)
Receives events from the real topic, parses them into event objects and passes them on to the OMRSTopicListeners registered with this connector.- Specified by:
processEventin interfaceOpenMetadataTopicListener- Parameters:
event- inbound event
-
disconnect
public void disconnect() throws ConnectorCheckedExceptionFree up any resources held since the connector is no longer needed.- Overrides:
disconnectin classConnectorBase- Throws:
ConnectorCheckedException- there is a problem within the connector.
-
-