Overview Tutorial API reference Examples Build Download ZmqMessage 0.1 - 21 Oct 2011

examples/zasync.cpp File Reference

#include "pthread.h"
#include "stdint.h"
#include <vector>
#include "ZmqMessage.hpp"

Classes

struct  async_task

Typedefs

typedef std::vector< async_taskTaskVec

Functions

zmq::context_t ctx (1)
void task_step (async_task &task)
template<typename QueueInserter>
void run_tasks (TaskVec &tasks, zmq::socket_t &s_res, QueueInserter q)
void * async_task_processor (void *)
int main (int, char **)

Variables

const char * req_endpoint = "inproc://req_ep"
const char * res_endpoint = "inproc://res_ep"
const char * stop_endpoint = "inproc://stop"
const char * to_worker_fields [] = {"message_type", "task_identifier"}
const char * from_worker_fields [] = {"message_type", "task_identifier"}
uint64_t message_queue_limit = 5
int max_task_steps = 10

Detailed Description

Copyright (c) 2010-2011 Phorm, Inc. GNU LGPL v 3.0, see http://www.gnu.org/licenses/lgpl-3.0-standalone.html
Author:
Andrey Skryabin <andrew@zmqmessage.org>, et al.
Demonstrating ZmqMessage queueing functionality for delayed sending of messages to implement asynchronous worker thread. (Note that currently queueing has proven working only for PUSH-PULL sockets.)

Typedef Documentation

typedef std::vector<async_task> TaskVec


Function Documentation

void* async_task_processor ( void *   ) 

Examples:
zasync.cpp.

zmq::context_t ctx (  ) 

Examples:
zasync.cpp, zbisort.cpp, zqueue.cpp, zserialize.cpp, and zsort.cpp.

int main ( int  ,
char **   
)

Examples:
zasync.cpp, zbisort.cpp, zqueue.cpp, zserialize.cpp, and zsort.cpp.

template<typename QueueInserter>
void run_tasks ( TaskVec tasks,
zmq::socket_t &  s_res,
QueueInserter  q 
)

Examples:
zasync.cpp.

void task_step ( async_task task  ) 

Examples:
zasync.cpp.


Variable Documentation

const char* from_worker_fields[] = {"message_type", "task_identifier"}

Examples:
zasync.cpp.

int max_task_steps = 10

Examples:
zasync.cpp.

uint64_t message_queue_limit = 5

Examples:
zasync.cpp.

const char* req_endpoint = "inproc://req_ep"

Examples:
zasync.cpp.

const char* res_endpoint = "inproc://res_ep"

Examples:
zasync.cpp.

const char* stop_endpoint = "inproc://stop"

Examples:
zasync.cpp.

const char* to_worker_fields[] = {"message_type", "task_identifier"}

Examples:
zasync.cpp.


ZmqMessage 0.1 — open source software, support@zmqmessage.org