litestomp
Functions
stomp_messenger.c File Reference
#include "stomp_messenger.h"

Functions

stomp_messenger_tstomp_messenger_init ()
 
void stomp_messenger_destroy (stomp_messenger_t **messenger)
 
void stomp_messenger_set_timeout (stomp_messenger_t *messenger, int32_t timeout)
 
stomp_status_code_t stomp_set_endpoint (stomp_messenger_t *messenger, const char *uri)
 
stomp_status_code_t stomp_connect (stomp_messenger_t *messenger, stomp_connection_header_t *header, int32_t timeout)
 
stomp_status_code_t stomp_disconnect (stomp_messenger_t *messenger, stomp_disconnection_header_t *header)
 
stomp_status_code_t stomp_subscribe (stomp_messenger_t *messenger, stomp_subscription_header_t *header)
 
stomp_status_code_t stomp_unsubscribe (stomp_messenger_t *messenger, stomp_subscription_header_t *header)
 
stomp_status_code_t stomp_ack (stomp_messenger_t *messenger, stomp_ack_header_t *header)
 
stomp_status_code_t stomp_nack (stomp_messenger_t *messenger, stomp_ack_header_t *header)
 
stomp_status_code_t stomp_begin (stomp_messenger_t *messenger, stomp_transaction_header_t *header)
 
stomp_status_code_t stomp_commit (stomp_messenger_t *messenger, stomp_transaction_header_t *header)
 
stomp_status_code_t stomp_abort (stomp_messenger_t *messenger, stomp_transaction_header_t *header)
 
stomp_status_code_t stomp_send (stomp_messenger_t *messenger, stomp_send_header_t *header, stomp_message_t *message)
 
stomp_status_code_t stomp_receive (stomp_messenger_t *messenger, stomp_receive_header_t *header, stomp_message_t *message)
 

Function Documentation

stomp_status_code_t stomp_abort ( stomp_messenger_t messenger,
stomp_transaction_header_t header 
)

Aborts a transaction

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
stomp_status_code_t stomp_ack ( stomp_messenger_t messenger,
stomp_ack_header_t header 
)

Acknowledges the processing of a message

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
stomp_status_code_t stomp_begin ( stomp_messenger_t messenger,
stomp_transaction_header_t header 
)

Begin a transaction

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
stomp_status_code_t stomp_commit ( stomp_messenger_t messenger,
stomp_transaction_header_t header 
)

Commits a transaction

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
stomp_status_code_t stomp_connect ( stomp_messenger_t messenger,
stomp_connection_header_t header,
int32_t  timeout 
)

Connects to the endpoint associated with the messenger

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
timeoutthe timeout in milliseconds
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
Examples:
messenger/client.c, and messenger/server.c.
stomp_status_code_t stomp_disconnect ( stomp_messenger_t messenger,
stomp_disconnection_header_t header 
)

Disconnects from the endpoint associated with the messenger

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
Examples:
messenger/client.c, and messenger/server.c.
void stomp_messenger_destroy ( stomp_messenger_t **  messenger)

Destroys the messenger object. The object will be unusable after destruction

Parameters
messengerAn instance of the messenger object
Examples:
messenger/client.c, and messenger/server.c.
stomp_messenger_t* stomp_messenger_init ( )

Copyright 2016 Otavio Rodolfo Piske

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Examples:
messenger/client.c, and messenger/server.c.
void stomp_messenger_set_timeout ( stomp_messenger_t messenger,
int32_t  timeout 
)

Sets the timeout for messenger communication. The value set also applies to receipt messages

Returns
A messenger object that can be used to exchange data via STOMP
Parameters
timeoutthe timeout in milliseconds
stomp_status_code_t stomp_nack ( stomp_messenger_t messenger,
stomp_ack_header_t header 
)

Not-acknowledges the processing of a message

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
stomp_status_code_t stomp_receive ( stomp_messenger_t messenger,
stomp_receive_header_t header,
stomp_message_t message 
)

Reads the exchange data from the broker. The returned exchange may be a message or an error.

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
messagethe message to exchange
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
Examples:
messenger/server.c.
stomp_status_code_t stomp_send ( stomp_messenger_t messenger,
stomp_send_header_t header,
stomp_message_t message 
)

Sends a message

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
messagethe message to exchange
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
Examples:
messenger/client.c.
stomp_status_code_t stomp_set_endpoint ( stomp_messenger_t messenger,
const char *  uri 
)

Sets the communication endpoint for the message exchange.

Parameters
messengerAn instance of the messenger object
uriA connection uri in the stomp://[user]:[password]<hostname>:<port>/<endpoint address>="">
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
Examples:
messenger/client.c, and messenger/server.c.
stomp_status_code_t stomp_subscribe ( stomp_messenger_t messenger,
stomp_subscription_header_t header 
)

Subscribes to the endpoint associated with the messenger

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object
Examples:
messenger/server.c.
stomp_status_code_t stomp_unsubscribe ( stomp_messenger_t messenger,
stomp_subscription_header_t header 
)

Unsubscribes from the endpoint associated with the messenger

Parameters
messengerA pointer to an instance of the messenger object
headerA pointer to an instance of the appropriate header object for the given exchange. The instance of the object must contain the required frame headers as expected by the frame.
Returns
STOMP_SUCCESS if successful or STOMP_FAILURE is failed. Upon failure, the code will set the error details on the status member of the messenger object