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, SecureConnectorExtension, VirtualConnectorExtension, OMRSTopic, OpenMetadataTopicListener

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.
  • Field Details

    • auditLog

      protected AuditLog auditLog
  • Constructor Details

    • OMRSTopicConnector

      public OMRSTopicConnector()
      Default constructor
  • Method Details

    • initializeEmbeddedConnectors

      public void initializeEmbeddedConnectors(List<Connector> embeddedConnectors)
      Registers itself as a listener of any OpenMetadataTopicConnectors that are passed as embedded connectors.
      Specified by:
      initializeEmbeddedConnectors in interface VirtualConnectorExtension
      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:
      setAuditLog in interface AuditLoggingComponent
      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:
      getConnectorComponentDescription in interface AuditLoggingComponent
      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:
      setEventProtocolLevel in interface OMRSTopic
      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:
      registerListener in interface OMRSTopic
      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:
      registerListener in interface OMRSTopic
      Parameters:
      topicListener - object implementing the OMRSTopicListener interface
      serviceName - 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:
      registerListener in interface OMRSTopic
      Parameters:
      topicListener - object implementing the OMRSTopicRepositoryEventListener interface
      serviceName - name of the service that the listener is from
    • start

      public void start() throws ConnectorCheckedException
      Indicates that the connector is completely configured and can begin processing. OMRSTopicConnector needs to pass on the start() to its embedded connectors.
      Overrides:
      start in class ConnectorBase
      Throws:
      ConnectorCheckedException - there is a problem within the connector.
    • sendRegistryEvent

      public CompletableFuture<Boolean> sendRegistryEvent(OMRSRegistryEvent registryEvent) throws ConnectorCheckedException
      Send the registry event to the OMRS Topic connector and manage errors
      Specified by:
      sendRegistryEvent in interface OMRSTopic
      Parameters:
      registryEvent - properties of the event to send
      Returns:
      a future that contains the result of send event
      Throws:
      ConnectorCheckedException - the connector is not able to communicate with the event bus
    • sendTypeDefEvent

      public CompletableFuture<Boolean> sendTypeDefEvent(OMRSTypeDefEvent typeDefEvent) throws ConnectorCheckedException
      Send the TypeDef event to the OMRS Topic connector (providing TypeDef Events are enabled).
      Specified by:
      sendTypeDefEvent in interface OMRSTopic
      Parameters:
      typeDefEvent - properties of the event to send
      Returns:
      a future that contains the result of sendEvent
      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:
      sendInstanceEvent in interface OMRSTopic
      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:
      processEvent in interface OpenMetadataTopicListener
      Parameters:
      event - inbound event
    • disconnect

      public void disconnect() throws ConnectorCheckedException
      Free up any resources held since the connector is no longer needed.
      Overrides:
      disconnect in class ConnectorBase
      Throws:
      ConnectorCheckedException - there is a problem within the connector.