Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InvokeCallback ¶
func InvokeCallback(eventSubscriptionMap map[string]map[EventType]EventCallback, messageID string, eventType EventType)
InvokeCallback invokes relevant callback in the given events subscription map.
Types ¶
type EventCallback ¶
type EventCallback func()
EventCallback is the type for subscription callbacks.
type EventType ¶
type EventType string
EventType is the type of transportation-events that may occur.
const ( // DeliveryAttempt event occurs when an attempted transport-delivery operation is attempted (sent to servers). DeliveryAttempt EventType = "attempt" // DeliverySuccess event occurs when an attempted transport-delivery operation is successful (ack from servers). DeliverySuccess EventType = "success" // DeliveryFailure event occurs when an attempted transport-delivery operation fails. DeliveryFailure EventType = "failure" )
type KafkaProducer ¶
type KafkaProducer struct {
// contains filtered or unexported fields
}
Producer abstracts hub-of-hubs-kafka-transport kafka-producer's generic usage.
func NewKafkaProducer ¶
func NewKafkaProducer(compressor compressor.Compressor, log logr.Logger, environmentManager *helper.ConfigManager) (*KafkaProducer, error)
NewProducer returns a new instance of Producer object.
func (*KafkaProducer) SendAsync ¶
func (p *KafkaProducer) SendAsync(msg *Message)
SendAsync sends a message to the sync service asynchronously.
func (*KafkaProducer) Subscribe ¶
func (p *KafkaProducer) Subscribe(messageID string, callbacks map[EventType]EventCallback)
Subscribe adds a callback to be delegated when a given event occurs for a message with the given ID.
func (*KafkaProducer) SupportsDeltaBundles ¶
func (p *KafkaProducer) SupportsDeltaBundles() bool
SupportsDeltaBundles returns true. kafka does support delta bundles.
type Message ¶
type Message struct { Key string ID string `json:"id"` MsgType string `json:"msgType"` Version string `json:"version"` Payload []byte `json:"payload"` }
Message abstracts a message object to be used by different transport components.
type Producer ¶
type Producer interface { // SendAsync sends a message to the transport component asynchronously. SendAsync(message *Message) // Subscribe adds a callback to be delegated when a given event occurs for a message with the given ID. Subscribe(messageID string, callbacks map[EventType]EventCallback) // Start starts the transport. Start() // Stop stops the transport. Stop() // SupportsDeltaBundles returns true if the transport layer supports delta bundles, otherwise false. SupportsDeltaBundles() bool }
type SyncServiceProducer ¶
type SyncServiceProducer struct {
// contains filtered or unexported fields
}
SyncService abstracts Sync Service client.
func NewSyncServiceProducer ¶
func NewSyncServiceProducer(compressor compressor.Compressor, log logr.Logger, env *helper.ConfigManager) (*SyncServiceProducer, error)
NewSyncService creates a new instance of SyncService.
func (*SyncServiceProducer) SendAsync ¶
func (s *SyncServiceProducer) SendAsync(message *Message)
SendAsync function sends a message to the sync service asynchronously.
func (*SyncServiceProducer) Start ¶
func (s *SyncServiceProducer) Start()
Start function starts sync service.
func (*SyncServiceProducer) Stop ¶
func (s *SyncServiceProducer) Stop()
Stop function stops sync service.
func (*SyncServiceProducer) Subscribe ¶
func (s *SyncServiceProducer) Subscribe(messageID string, callbacks map[EventType]EventCallback)
Subscribe adds a callback to be delegated when a given event occurs for a message with the given ID.
func (*SyncServiceProducer) SupportsDeltaBundles ¶
func (s *SyncServiceProducer) SupportsDeltaBundles() bool
SupportsDeltaBundles returns false. sync service doesn't support delta bundles.