This API documentation is for Ballerina 1.2.0. View API documentation for the latest release.

Listener - nats : Listener

Represents the NATS server connection to which a subscription service should be bound in order to receive messages of the corresponding subscription.

Constructor

__init

(Connection connection)

  • connection Connection
  • An established NATS connection.

Methods

Stops consuming messages and detaches the service from the nats:Listener.

Stops the nats:Listener gracefully.

Stops the nats:Listener forcefully.

LifeCycle Methods

Binds a service to the nats:Listener.

Starts the nats:Listener.

Methods

__detach

(service s)

returns error?

Stops consuming messages and detaches the service from the nats:Listener.

Parameters

  • s service
  • Type descriptor of the service

  • Return Type

    (error?)
  • () or else a nats:Error upon failure to detach the service

__gracefulStop

()

returns error?

Stops the nats:Listener gracefully.

  • Return Type

    (error?)
  • () or else a nats:Error upon failure to stop the listener

__immediateStop

()

returns error?

Stops the nats:Listener forcefully.

  • Return Type

    (error?)
  • () or else a nats:Error upon failure to stop the listener

LifeCycle Methods

__attach

(service s, string? name)

returns error?

Binds a service to the nats:Listener.

Parameters

  • s service
  • Type descriptor of the service

  • name string? (default ())
  • Name of the service

  • Return Type

    (error?)
  • () or else a nats:Error upon failure to register the listener

__start

()

returns error?

Starts the nats:Listener.

  • Return Type

    (error?)
  • () or else a nats:Error upon failure to start the listener