skeleton wip
This commit is contained in:
70
src/broker/nats-broker.cpp
Normal file
70
src/broker/nats-broker.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
/*!
|
||||
* nats-broker.cpp
|
||||
*
|
||||
* 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: 13/11/2019
|
||||
*
|
||||
*/
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
#include <adapters/libevent.h>
|
||||
|
||||
#include "nats-broker.h"
|
||||
|
||||
#include <nats.h>
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn NatsBroker
|
||||
*
|
||||
* @brief Constructor of the Nats Broker.
|
||||
*/
|
||||
NatsBroker::NatsBroker(void) : m_conn(NULL), m_opts(NULL), m_sub(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn ~NatsBroker
|
||||
*
|
||||
* @brief Destructor of the Nats.
|
||||
*/
|
||||
NatsBroker::~NatsBroker(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn setup
|
||||
*
|
||||
* @brief Setup the Broker.
|
||||
*/
|
||||
int NatsBroker::setup(void)
|
||||
{
|
||||
natsStatus the_status;
|
||||
|
||||
nats_Open(-1);
|
||||
|
||||
// One time initialization of things that we need.
|
||||
natsLibevent_Init();
|
||||
|
||||
if (natsOptions_Create(&m_opts) != NATS_OK)
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user