litestomp
Data Structures | Typedefs | Functions
stomp_messenger.h File Reference
#include <apr-1/apr_general.h>
#include <apr-1/apr_network_io.h>
#include <apr-1/apr_hash.h>
#include <apr-1/apr_uri.h>
#include "stomp_status.h"
#include "stomp_connection.h"
#include "stomp_engine.h"
#include "stomp_frame.h"
#include "stomp_io.h"
#include "stomp_headers.h"
#include "stomp_ex_properties.h"
#include "stomp_message.h"

Go to the source code of this file.

Data Structures

struct  stomp_messenger_t_
 

Typedefs

typedef apr_uri_t stomp_uri_t
 
typedef struct stomp_messenger_t_ stomp_messenger_t
 

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)
 

Typedef Documentation

This struct provides an abstraction for some of the message exchange details

typedef apr_uri_t stomp_uri_t

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.

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
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
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
stomp_messenger_t* stomp_messenger_init ( )

Initializes the messenger object

Returns
A messenger object that can be used to exchange data via STOMP

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.

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
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
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
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
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