Commit 64dea881 authored by fred's avatar fred
Browse files

update zerogw class according to http api

parent ad233cc7
No preview for this file type
docs/ncs_dev.png

451 KB | W: | H:

docs/ncs_dev.png

454 KB | W: | H:

docs/ncs_dev.png
docs/ncs_dev.png
docs/ncs_dev.png
docs/ncs_dev.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -82,7 +82,7 @@ void Service::Http_api_init()
m_ncs_params.api_port == 0 ? port = 2502 : port = m_ncs_params.api_port;
QThread *thread_api_payload = new QThread;
api_payload = new Api_payload(port);
api_payload = new Api_payload(m_ncs_params.base_directory, port);
api_payload->moveToThread(thread_api_payload);
thread_api_payload->start();
//connect(this, SIGNAL(shutdown()), api_payload, SLOT(destructor()), Qt::BlockingQueuedConnection);
......@@ -90,14 +90,14 @@ void Service::Http_api_init()
QThread *thread_api_node = new QThread;
api_node = new Api_node(port + 1);
api_node = new Api_node(m_ncs_params.base_directory, port + 1);
api_node->moveToThread(thread_api_node);
thread_api_node->start();
//connect(this, SIGNAL(shutdown()), api_node, SLOT(destructor()), Qt::BlockingQueuedConnection);
//connect(api_node, SIGNAL(forward_payload(BSONObj)), dispatch, SLOT(push_payload(BSONObj)), Qt::QueuedConnection);
QThread *thread_api_workflow = new QThread;
api_workflow = new Api_workflow(port + 2);
api_workflow = new Api_workflow(m_ncs_params.base_directory, port + 2);
api_workflow->moveToThread(thread_api_workflow);
thread_api_workflow->start();
//connect(this, SIGNAL(shutdown()), api_workflow, SLOT(destructor()), Qt::BlockingQueuedConnection);
......
......@@ -21,6 +21,8 @@ Estp:
- ipc:///tmp/zgwestp.sock
Routing:
limits:
max-body-size: 200Mi
routing: !Suffix ~
routing-by: !Header Host
map:
......@@ -49,7 +51,7 @@ Routing:
zmq-forward:
enabled: yes
socket:
- !zmq.Bind "tcp://192.168.0.9:7001"
- !zmq.Bind "tcp://127.0.0.1:7001"
contents:
- !Uri ~
- !Body ~
......@@ -60,15 +62,17 @@ Routing:
zmq-forward:
enabled: yes
socket:
- !zmq.Connect "tcp://192.168.0.5:2503"
- !zmq.Connect "tcp://127.0.0.1:2503"
contents:
- !Method
- !Uri
- !Header X-user-token
- !Header X-node-uuid
- !Header X-node-password
- !Header X-workflow-uuid
- !Header X-payload-filename
- !Header X-payload-type
- !Header X-payload-action
- !Body ~
timeout: 2
retry: !RetryFirst
......@@ -77,15 +81,12 @@ Routing:
zmq-forward:
enabled: yes
socket:
- !zmq.Connect "tcp://192.168.0.5:2504"
- !zmq.Connect "tcp://127.0.0.1:2504"
contents:
- !Method
- !Uri
- !Header X-node-uuid
- !Header X-node-password
- !Header X-workflow-uuid
- !Header X-payload-filename
- !Header X-payload-type
- !Header X-user-token
- !Header X-workflow-name
- !Body ~
timeout: 2
retry: !RetryFirst
......@@ -94,15 +95,12 @@ Routing:
zmq-forward:
enabled: yes
socket:
- !zmq.Connect "tcp://192.168.0.5:2505"
- !zmq.Connect "tcp://127.0.0.1:2505"
contents:
- !Method
- !Uri
- !Header X-node-uuid
- !Header X-node-password
- !Header X-workflow-uuid
- !Header X-payload-filename
- !Header X-payload-type
- !Header X-user-token
- !Header X-node-name
- !Body ~
timeout: 2
retry: !RetryFirst
......@@ -111,15 +109,11 @@ Routing:
zmq-forward:
enabled: yes
socket:
- !zmq.Connect "tcp://192.168.0.5:2506"
- !zmq.Connect "tcp://127.0.0.1:2506"
contents:
- !Method
- !Uri
- !Header X-node-uuid
- !Header X-node-password
- !Header X-workflow-uuid
- !Header X-payload-filename
- !Header X-payload-type
- !Header X-admin-token
- !Body ~
timeout: 2
retry: !RetryFirst
......
This diff is collapsed.
......@@ -42,23 +42,27 @@ class Zerogw : public QObject
{
Q_OBJECT
public:
Zerogw(int port, QObject *parent = 0);
Zerogw(QString basedirectory, int port, QObject *parent = 0);
~Zerogw();
protected:
QBool checkAuth(QString token, BSONObjBuilder &payload_builder, BSONObj &a_user);
QString buildResponse(QString action, QString data1, QString data2="");
QString m_basedirectory;
Mongodb *mongodb_;
Zeromq *zeromq_;
zmq::context_t *m_context;
QSocketNotifier *check_http_data;
zmq::socket_t *m_socket_http;
zmq::socket_t *m_socket_zerogw;
QMutex *m_mutex_http;
zmq::message_t *m_message;
QMutex *m_mutex;
zmq::socket_t *z_push_api;
zmq::message_t *z_message;
signals:
void forward_payload(BSONObj data);
......@@ -73,7 +77,7 @@ class Api_payload : public Zerogw
{
Q_OBJECT
public:
Api_payload(int port);
Api_payload(QString basedirectory, int port);
private slots:
......@@ -86,7 +90,7 @@ class Api_node : public Zerogw
{
Q_OBJECT
public:
Api_node(int port);
Api_node(QString basedirectory, int port);
private slots:
void receive_http_payload();
......@@ -98,7 +102,18 @@ class Api_workflow : public Zerogw
{
Q_OBJECT
public:
Api_workflow(int port);
Api_workflow(QString basedirectory, int port);
private slots:
void receive_http_payload();
};
class Api_user : public Zerogw
{
Q_OBJECT
public:
Api_user(QString basedirectory, int port);
private slots:
void receive_http_payload();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment