56 lines
1.6 KiB
C
56 lines
1.6 KiB
C
/*!
|
|
* nats_broker.h
|
|
*
|
|
* Copyright (c) 2015-2019, NADAL Jean-Baptiste. All rights reserved.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
* MA 02110-1301 USA
|
|
*
|
|
* @Author: NADAL Jean-Baptiste
|
|
* @Date: 26/12/2019
|
|
*
|
|
*/
|
|
|
|
#ifndef _NATS_BROKER_H
|
|
#define _NATS_BROKER_H
|
|
|
|
/*------------------------------- INCLUDES ----------------------------------*/
|
|
|
|
#include <nats.h>
|
|
|
|
/*------------------------------- TYPEDEFS ----------------------------------*/
|
|
|
|
typedef struct nats_broker_s nats_broker_t;
|
|
|
|
/**
|
|
* Nats Broker Container.
|
|
*/
|
|
struct nats_broker_s
|
|
{
|
|
natsConnection *conn;
|
|
natsOptions *opts;
|
|
natsSubscription *sub;
|
|
};
|
|
|
|
/*--------------------------- PUBLIC FUNCTIONS -------------------------------*/
|
|
|
|
extern nats_broker_t *nats_broker_new(void);
|
|
extern void nats_broker_free(nats_broker_t *broker);
|
|
|
|
extern int nats_broker_setup(nats_broker_t *broker, struct event_base *ev_base);
|
|
extern int nats_broker_connect(nats_broker_t *broker, const char *subject);
|
|
|
|
#endif /*_NATS_BROKER_H */
|