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

Clients - rabbitmq : Message

Provides the functionality to manipulate the messages received by the consumer services.

Remote Methods

basicAck

Acknowledges one or several received messages.

basicNack

Rejects one or several received messages.

Methods

Retrieves the delivery tag of the message.

Retrieves the properties of the message (i.

Retrieves the text content of the RabbitMQ message.

Retrieves the float content of the RabbitMQ message.

Retrieves the int content of the RabbitMQ message.

Retrieves the byte array content of the RabbitMQ message.

Retrieves the JSON content of the RabbitMQ message.

Retrieves the XML content of the RabbitMQ message.

basicAck

(boolean multiple)

returns Error?

Acknowledges one or several received messages.

 rabbitmq:Error? ackResult = message->basicAck(true);

Parameters

  • multiple boolean (default false)
  • true to acknowledge all messages up to and including the called on message and false to acknowledge just the called on message

  • Return Type

    (Error?)
  • A rabbitmq:Error if an I/O error is encountered or else ()

basicNack

(boolean multiple, boolean requeue)

returns Error?

Rejects one or several received messages.

 rabbitmq:Error? nackResult = message->basicNack(true, requeue = false);

Parameters

  • multiple boolean (default false)
  • true to reject all messages up to and including the called on message and false to reject just the called on message

  • requeue boolean (default true)
  • true if the rejected message(s) should be re-queued rather than discarded/dead-lettered

  • Return Type

    (Error?)
  • A rabbitmq:Error if an I/O error is encountered or else ()

getDeliveryTag

()

returns int

Retrieves the delivery tag of the message.

 int deliveryTag = message.getDeliveryTag();
  • Return Type

    (int)
  • The delivery tag of the message

getProperties

()

returns BasicProperties | Error

Retrieves the properties of the message (i.e., routing headers etc.).

 rabbitmq:BasicProperties|rabbitmq:Error properties = message.getProperties();
  • Return Type

    (BasicProperties | Error)
  • Properties of the message or else a rabbitmq:Error if an error is encountered

getTextContent

()

returns string | Error

Retrieves the text content of the RabbitMQ message.

 string|rabbitmq:Error msgContent = message.getTextContent();
  • Return Type

    (string | Error)
  • Message data as string value or else a rabbitmq:Error if an error is encountered

getFloatContent

()

returns float | Error

Retrieves the float content of the RabbitMQ message.

 float|rabbitmq:Error msgContent = message.getFloatContent();
  • Return Type

    (float | Error)
  • Message data as a float value or else a rabbitmq:Error if an error is encountered

getIntContent

()

returns int | Error

Retrieves the int content of the RabbitMQ message.

 int|rabbitmq:Error msgContent = message.getIntContent();
  • Return Type

    (int | Error)
  • Message data as an int value or else a rabbitmq:Error if an error is encountered

getByteArrayContent

()

returns byte[]

Retrieves the byte array content of the RabbitMQ message.

 byte[] msgContent = message.getIntContent();
  • Return Type

    (byte[])
  • Message data as a byte array

getJSONContent

()

returns json | Error

Retrieves the JSON content of the RabbitMQ message.

 json|rabbitmq:Error msgContent = message.getJSONContent();
  • Return Type

    (json | Error)
  • Message data as a JSON value or else a rabbitmq:Error if an error is encountered

getXMLContent

()

returns xml | Error

Retrieves the XML content of the RabbitMQ message.

 xml|rabbitmq:Error msgContent = message.getXMLContent();
  • Return Type

    (xml | Error)
  • Message data as an XML value or else a rabbitmq:Error if an error is encountered