eventhandler

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractEventHandler

type AbstractEventHandler struct {
	EventHandler
	// contains filtered or unexported fields
}

Base class for event handlers, implementing all service registry functionalities. The abstract class does not implement PublishEvent, getInterfaces, and getMetadata, they must be implemented by a sub class.

func (*AbstractEventHandler) RegisterEventService

func (e *AbstractEventHandler) RegisterEventService(eventType types.EventType) (EventService, error)

func (*AbstractEventHandler) UnregisterEventPublisherSystem

func (e *AbstractEventHandler) UnregisterEventPublisherSystem() error

func (*AbstractEventHandler) UnregisterEventService

func (e *AbstractEventHandler) UnregisterEventService(eventService EventService) error

type EventHandler

type EventHandler interface {

	// Sends a given event to the messaging broker, the routing of the messages are defined by the used event handler implementation and the given event service
	PublishEvent(event types.Event, eventService EventService) error

	// Removes the event handler system and all it's services from the service registry,
	// Should be called on shutdown of the system, or when the event handler is no longer to be used.
	UnregisterEventPublisherSystem() error

	RegisterEventService(eventType types.EventType) (EventService, error)
	UnregisterEventService(eventService EventService) error
	// contains filtered or unexported methods
}

Event handler, is a system that can Publish events to an implemented messaging broker.

func EventPublisherFactory

func EventPublisherFactory(
	eventHandlerImplementation types.EventHandlerImplementationType,
	eventHandlerAddress string,
	eventHandlerPort int,
	eventHandlerDomainAddress string,
	eventHandlerDomainPort int,
	systemName string,
	serviceRegistryAddress string,
	serviceRegistryPort int,
	serviceRegistryImplementation serviceregistry.ServiceRegistryImplementationType,
	certFilePath string,
	keyFilePath string,
	truststoreFilePath string,
) (EventHandler, error)

Creates a new event handler system of the given implementation eventHandlerImplementation. The event handler will automatically on creation be registered to the service registry.

type EventService

type EventService interface {
	GetEventServiceId() uuid.UUID
	GetEventType() types.EventType
	PublishEvent(event types.Event) error
	UnregisterEventService() error
	// contains filtered or unexported methods
}

type EventServiceImplementation

type EventServiceImplementation struct {
	// contains filtered or unexported fields
}

func (*EventServiceImplementation) GetEventServiceId

func (e *EventServiceImplementation) GetEventServiceId() uuid.UUID

func (*EventServiceImplementation) GetEventType

func (e *EventServiceImplementation) GetEventType() types.EventType

func (*EventServiceImplementation) PublishEvent

func (e *EventServiceImplementation) PublishEvent(event types.Event) error

func (*EventServiceImplementation) UnregisterEventService

func (e *EventServiceImplementation) UnregisterEventService() error

type RabbitmqEventHandler

type RabbitmqEventHandler struct {

	// Extends a base event handler class, giving general event handler functionalities.
	// The functions PublishEvent, getInterfaces, and getMetadata, must be implemented as AbstractEventHandler does not do so.
	*AbstractEventHandler
}

RabbitMQ event handler, publishes messages via AMQP

func (*RabbitmqEventHandler) PublishEvent

func (r *RabbitmqEventHandler) PublishEvent(event types.Event, eventService EventService) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL