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

Listener - nats : StreamingListener

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

Constructor

__init

(Connection connection, string? clientId, string clusterId, StreamingConfig? streamingConfig)

  • connection Connection
  • An established NATS connection

  • clientId string? ()
  • The unique identifier of the client. The clientId should be unique across all the subscriptions. Therefore, multilpe subscription services cannot be bound to a single listener

  • clusterId string test-cluster
  • The unique identifier of the cluster configured in the NATS server. The default value is test-cluster

  • streamingConfig StreamingConfig? ()
  • The configuration related to the NATS streaming connectivity

Methods

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

Stops the nats:StreamingListener gracefully.

Stops the nats:StreamingListener forcefully.

LifeCycle Methods

Binds a service to the nats:StreamingListener.

Starts the nats:StreamingListener.

Methods

__detach

(service s)

returns error?

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

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:StreamingListener gracefully.

  • Return Type

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

__immediateStop

()

returns error?

Stops the nats:StreamingListener 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:StreamingListener.

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:StreamingListener.

  • Return Type

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