hestan

package
v0.0.0-...-81c1d68 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: MIT Imports: 15 Imported by: 0

README

hestan (hexa stan) in implementation of Nats-streaming broker for hexa SDK using stan client library of NATS.


Notes:

  • If you need to set unsubscribe options for a subscription, you can just add a function to the subscription options which gets subscription and decide whether should close or unsubscribe to it if user invoke close method of the receiver, but for now we don't need to it and just close all subscriptions if user invoke close method of the Receiver.

  • We do not support multichannel and channelPattern in subscription options.

Documentation

Overview

Package hestan (hexa stan) in implementation of Nats-streaming broker for hexa SDK using stan client library of NATS.

hestan (hexa stan) in implementation of Nats-streaming broker for hexa SDK using stan client library of NATS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ManualAckOption

func ManualAckOption(waitDuration time.Duration) []stan.SubscriptionOption

ManualAckOption returns option which set subscription on manual ack with ack wait value.

func NewEmitter

func NewEmitter(o EmitterOptions) (hevent.Emitter, error)

NewEmitter returns new emitter with tha nats-streaming driver.

func NewReceiver

func NewReceiver(o ReceiverOptions) (hevent.Receiver, error)

NewReceiver returns new instance of the Receiver using nats-streaming driver.

func UniqueClientID

func UniqueClientID(prefix string) string

UniqueClientID generates a new client id formatted by this pattern: {prefix}-{data}-{rand} e.g., accounting-ms-2020101318281-hn1ig8

Types

type EmitterOptions

type EmitterOptions struct {
	NatsCon           *nats.Conn
	StreamingCon      stan.Conn
	ContextPropagator hexa.ContextPropagator
	Encoder           hevent.Encoder
}

func (EmitterOptions) Validate

func (o EmitterOptions) Validate() error

type ReceiverOptions

type ReceiverOptions struct {
	NatsCon           *nats.Conn
	StreamingCon      stan.Conn
	ContextPropagator hexa.ContextPropagator
}

func (ReceiverOptions) Validate

func (o ReceiverOptions) Validate() error

type SubscriptionOptions

type SubscriptionOptions struct {
	Subject  string
	Group    string // provide it if you want to subscribe using queue group.
	Durable  string // provide it if you want durable subscription Position
	Position stan.SubscriptionOption
	Opts     []stan.SubscriptionOption

	Handler hevent.EventHandler
}

Jump to

Keyboard shortcuts

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