Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*opts)
func WithClientCert ¶
func WithConnectionName ¶
func WithLogger ¶
func WithRootCA ¶
func WithTimeout ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is a NATS object notification writer. It handles NATS JetStream connections and allows sending string representation of the address to the NATS server.
For correct operation must be created via New function. new(Writer) or Writer{} construction leads to undefined behaviour and is not safe.
func New ¶
New creates and inits new Writer. Connection is closed when passed context is done.
Returns error only if fails to open connection to a NATS server with provided configuration.
func (*Writer) Notify ¶
func (n *Writer) Notify(topic string, address *addressSDK.Address) error
Notify sends object address's string representation to the provided topic. Uses first 4 bytes of object ID as a message ID to support 'exactly once' message delivery.
Returns error only if: 1. underlying connection was closed and has not been established again; 2. NATS server could not respond that it has saved the message.