Xbus - Go client

A Go client for Xbus.


This is a regular Go library:

go get xbus.io/go-xbus

See the Xbus project for more info.


3.3.3 (2023-09-22)

  • EnvelopePurge: report the total envelope count in addition to the purged count

3.3.2 (2023-09-20)

  • api/json: fix a memory leak

3.3.1 (2022-12-16)

  • api: regen the control api (with added Debug service)

3.3.0 (2022-02-01)

  • Update gogo-nrpc, switch to nats.go (instead of go-nats)

3.2.1 (2021-01-06)

  • Fix a routine leak in envelope emission

3.2.0 (2020-12-16)

  • Update to xbus-api 3.2

  • Use github.com/rs/zerolog for logging

  • Replace raven-go with sentry-go

  • envelope api:
    • Fix a crash in Builder.CloseWithError

    • fix writing big messages

    • fix a deadlock in EnvelopeSender when envelope misbehave

3.1.0 (2020-06-08)


Starting with go-xbus 3.1.0 the module namespace is “xbus.io/go-xbus/v3”, make sure you update the client projects

  • Add a new message-oriented API to build/read envelopes

  • Support user/password authentication

  • Support session authentication

  • Fix json decoding of events

  • EnvelopeValidator: supports more cases

  • EnvelopeReceiver: allow partial access to the content

  • api: update to xbus-api 3.1

  • demo: Add a ‘hello’ worker

  • ActorProcessingContext: Change ‘Log’ into an interface that has a mock implementation in testutils.ActorServiceTester

  • cmd: Add a ‘–no-reconnect’ flag. If set, the client will shutdown instead of attempting reconnection when disconnected.

3.0.1 (2019-06-19)

  • cmd: add a helper for adding a --version flag to the root command

  • cert-renew: detect if the server took the new CSR

  • testutils: provide a test logger

3.0.0 (2019-03-26)

  • EnvelopeSender: add a SetMaxDelay(delay) method. Once called, a fragment will be emitted at least every delay.

  • Actor.OpenOutput automatically set a MaxDelay on the returned EnvelopeSender

  • Handle SERVERTOOBUSY in all the functions that send envelope fragments ( Client.SendEnvelope, Actor.CloseOutput).

  • Sentry: capture unformatted error message and params, which facilitates issue grouping by the sentry server.

3.0.0-rc.6 (2019-02-15)

  • API:

    • ProcessState.Envelope now returns a single Process

    • ProcessState.Envelope subject: emitter is now a method param

3.0.0-rc.5 (2019-02-01)

  • Provide utilities to test a ActorProcessService implementation easily without a NATS connexion (see the testutils module)

  • Fix a bad behavior when ActorProcessingContext Error() or End()

  • Beter detection of bad behaving ActorProcessService.Process() implementations

  • API: Change the global subject prefix to “xbus.default” instead of “xbus”


    This change breaks the API, all clients and server must be updated at the same time.

3.0.0-rc.4 (2019-01-22)

  • Fix a crash in EnvelopeReceiver.SetError if reception is already completed

  • Client.Startup: Don’t print ‘Start Services’ if services are not started

3.0.0-rc.3 (2019-01-07)

  • ActorProcessingContext: fix End() misbehavior leading to xbus Process crash

3.0.0-rc.2 (2018-12-27)

  • fullenv: handle vars

  • Client: Set the connect information

3.0.0-rc.1 (2018-12-14)

  • viper: refactor and improve configuration handling.

    • The client configuration file is now read-only, and the tls options are written to a separate file. Optionnaly, they can be written to individual files.

    • The actors dict now accept actor names as keys instead of integer values

  • client: After the initial connection, load the account & actors details from the server.

3.0.0-beta.16 (2018-12-03)

  • update xbus-api

    • Add CoreEvents.Envelope

    • Add EnvelopeEvent

  • Add Fullenv, a wrapper around the xbus-fullenv binary for easy testing

  • Add COptionsFromFile for loading a client configuration from a configuration file

  • Add ClientFromFile for loading a client from a configuration file

  • Fix new certificate saving after a renewal

3.0.0-beta.15 (2018-11-19)

  • update xbus-api

    • add ‘ProcessExportRequest.exportJobs’

    • rename “Graph” to “Pipeline”

3.0.0-beta.14 (2018-11-13)

  • update xbus-api

  • cmd:

    • register:

      • always update RootCA

      • add a flag to change the CSR hostname

    • renew-cert: csr and key renew

3.0.0-beta.13 (2018-10-30)

  • update xbus-api

3.0.0-beta.12 (2018-10-22)

  • Implements the new actor protocol (see xbus-api README). Consumers and workers must be adapted. See the demo actors for an example.

  • Actor subscription now auto-call ActorLeaving on Unsubscribe.

  • Client: If a ‘service’ is not found, the client is no longer started

  • Add a function to validate event type names

  • Add a nats-timeout option to xbus-client.

  • cmd: - Add a emit command that emit a single envelope and does not start the

    services. Useful for debugging purpose or as a basic integration tool.

3.0.0-beta.11 (2017-04-13)


This version is NOT protocol compatible with former versions of xbusd. xbusd and the clients must all be upgraded simultaneously.

  • Reimplement all the nats calls based on nrpc and the xbus-api files. The clients should have very little (if any) adaptations to do.

  • Add a GraphGet function

  • Cleanup

3.0.0-beta.10 (2017-10-19)

  • Add RavenLogger that can send logs to Sentry

  • Add a ‘sentry.dsn’ setting. If set, xbus.Client will send errors to sentry.

3.0.0-beta.9 (2017-09-19)

  • EnvelopeSender: add GetID

  • Fix: configuration file entry ‘persistent-store’ was ignored

  • Add a TLSTimeout setting (default 4s)

  • tools: cleanup cert-related functions

  • API

    • Clarify Item type: it is no longer a JsonRawMessage, but a []byte

    • Add ‘control.process.export’

    • Add ‘control.process.purge’

    • Better process filtering API

    • Add ‘control.envelope.purge’

    • Add ‘control.logs.purge’

    • Add ‘Expire’ attribute to AccountUpdateReq for specifying client certificate validity range.

3.0.0-beta.8 (2017-06-03)

  • API

    • New ‘postmortem’ APIs allow post mortem inspection of failed process

    • Cleaner ‘graph’ handling API

    • Add a ‘Gateway’ account type

    • Add ‘AccountRenewAPIKey’

    • Add ‘GetActors’

    • Add ‘WhoAmI’

  • Client:

    • Try harder to send processingend:

      • Log the processingend occurences in a persistent store

      • Retry calling processingend until server replies

    • Add ActorFind, ActorDelete, AccountFind, AccountDelete

  • Add a ‘UnregisterActorService’ for removing actor services from the registry

  • Add a ‘counter’ demo emitter

  • Add a constructor for EnvelopeSender that takes envelope and event IDs

3.0.0-beta.7 (2017-03-09)

  • Add support for fragmented envelopes:

    • Drop EnvelopeReader in favor of EnvelopeReceiver for receiving envelopes as streams of Items

    • Add EnvelopeSender for writing envelopes as streams of Items

    • Add Actor.OpenOutput

  • EnvelopeValidator: Add EventTypesKnown field

  • EnvelopeValidator: Better error handling in Add()

  • ProcessingEnd, ProcessingSuccess & ProcessingError now takes a context & ID instead of an envelope

3.0.0-beta.6 (2017-02-03)

  • Client.Startup & Shutdown now handle the connection to the bus:

    • ‘Connect’ should not be called before calling Startup()

    • On disconnection, the connection will be attempted until success

  • Fix demo actors

3.0.0-beta.5 (2017-01-26)

  • Add a ‘demo’ package, which contains some demonstration actor services:

    • A ‘demo.helloword’ emitter

    • A ‘demo.relay’ worker

    • A ‘demo.print-to-console’ consumer

  • Adjust some logs levels

  • Add Actor.GetIntSettingD for reading integer settings with a default value.

  • Add Actor.SendItemsContext for sending items within a context.

  • Allow custom hostDefs in CreateServerRootCA

3.0.0-beta.4 (2017-01-20)

  • Rename client.XBusClient to xbus.Client

  • xbus.Client can start/stop actors given the proper configuration

  • Provides a serve command that start a Client and its actors.

  • Merge Consumer, Emiter & Worker in Actor

  • Actor.Subscribe now have handler arg and returns the subscription that is no longer help by the Actor itself

  • Actor options ‘type’ and ‘settings’ are now in a sub-option ‘service’

  • Fix configuration writeback so it preserves non-xbus settings

  • Fix validation of events with 0 items


  • Extracted client, lib, tools and xbus-client/cmd from xbus 3.0.0-beta.3