zeromq

php ZeroMQ 的使用

匆匆过客 提交于 2020-07-26 09:51:16
一、ZeroMQ简介 ZMQ (以下 ZeroMQ 简称 ZMQ)是一个简单好用的传输层,像框架一样的一个 Socket Library,他使得 Socket 编程更加简单、简洁和性能更高。是一个消息处理队列库,可在多个线程、内核和主机盒之间弹性伸缩。ZMQ 的明确目标是“成为标准网络协议栈的一部分,之后进入 Linux 内核”。现在还未看到它们的成功。但是,它无疑是极具前景的、并且是人们更加需要的“传统”BSD 套接字之上的一层封装。ZMQ 让编写高性能网络应用程序极为简单和有趣。 与 RabbitMQ 相比,ZMQ 并不像是一个传统意义上的消息队列服务器,事实上,它也根本不是一个服务器,它更像是一个底层的网络通讯库,在 Socket API 之上做了一层封装,将网络通讯、进程通讯和线程通讯抽象为统一的 API 接口。 它是个类似于Socket的一系列接口,它跟Socket的区别是:普通的Socket是端到端的(1:1的关系),而ZMQ却是可以(N:M 的关系),人们对BSD套接字的了解较多的是点对点的连接,点对点连接需要显式地建立连接、销毁连接、选择协议(TCP/UDP)和处理错误等,而ZMQ屏蔽了这些细节,让你的网络编程更为简单。ZMQ用于node与node间的通信,node可以是主机或者是进程。 二、ZMQ三种基本模型 1、Request-Reply 2、Publisher

Why one might need JeroMQ if it can use JZMQ?

别等时光非礼了梦想. 提交于 2020-07-18 11:50:28
问题 Simple question. Why "porting" zmq on java and call it JeroMQ is good idea? 回答1: JeroMQ is an official project of the ZeroMQ community; it's a full port of the C++ libzmq library, supporting version 3.2. Advantages: Pure Java, so no need to link in C/C++ via JNI. This is extremely helpful on devices where native libraries are difficult or impossible. 100% compatible with the JZMQ API (the two projects agreed on a single API so you can import one or the other transparently). 100% compatible

Get TCP address information in ZeroMQ

浪子不回头ぞ 提交于 2020-07-18 10:03:27
问题 I want to connect clients to a server using ZeroMQ (java bindings, jzmq), but I need the TCP information badly, for example the TCP/IP address of a client request! The problem is, for being able to announce a service in the network I need to grab the TCP address of a request to be able to redirect clients to that service. The broker is a central "service registry" in that case. However, having ZeroMQ services on both sides, I do not see an option to retrieve that information. What I do now,

NanoMsg (NNG) & FlatBuffers the correct fit for this project?

社会主义新天地 提交于 2020-07-15 04:07:08
问题 Shout out if there is something better we should consider: I am looking for a very quick and simple way to get several programs (e.g. 5) - each running on separate nodes on a private OpenStack cloud to talk to each other. Packets will be short C++ structs (less than 100 bytes) Traffic will be light (probably less than 100/second) Latency is really not an issue. (what is a few ms between friends?) - we have lots of cycles and memory Messages should be done as pub/sub client/server paradigm

NanoMsg (NNG) & FlatBuffers the correct fit for this project?

谁都会走 提交于 2020-07-15 04:05:56
问题 Shout out if there is something better we should consider: I am looking for a very quick and simple way to get several programs (e.g. 5) - each running on separate nodes on a private OpenStack cloud to talk to each other. Packets will be short C++ structs (less than 100 bytes) Traffic will be light (probably less than 100/second) Latency is really not an issue. (what is a few ms between friends?) - we have lots of cycles and memory Messages should be done as pub/sub client/server paradigm

ZMQ Multiple Publisher and Single Subscriber — data loss observed

独自空忆成欢 提交于 2020-06-13 08:47:05
问题 I have created 2 Publishers connecting to the same static location . Publisher1 dummyFrontEnd::dummyFrontEnd():context(1),socket(context,ZMQ_PUB) { } void dummyFrontEnd::Init() { socket.connect("tcp://127.0.0.1:5555"); cout << "Connecting .... " << endl; } void dummyFrontEnd::SendTwoTables() { cout << "In SendTwoTables" <<endl; while(1) { canlogreq canLogObj = canlogreq::default_instance(); canLogObj.set_fromhours(11); canLogObj.set_fromminutes(7); canLogObj.set_fromseconds(2); canLogObj.set

PHP ZMQ Extension: Unable to load dynamic library

眉间皱痕 提交于 2020-05-13 06:35:08
问题 I'm working on Wampserver on Windows 10. I'm using an extension called ZMQ. I downloaded the DLLS from: https://pecl.php.net/package/zmq/1.1.3/windows I previously used the version of the extension for PHP 5.6 and it worked. The extension however had a bug, so I decided to upgrade my php version to 7.0.4 and try the new version of the extension. The extension was successfully installed and it appears in the phpinfo(), but when I try to run "php -v" from the command line (or the CLI service

Kafka、Redis和其它消息组件比较

谁说我不能喝 提交于 2020-05-05 11:39:24
Kafka作为时下最流行的开源消息系统,被广泛地应用在数据缓冲、异步通信、汇集日志、系统解耦等方面。相比较于RocketMQ等其他常见消息系统,Kafka在保障了大部分功能特性的同时,还提供了超一流的读写性能。 针对Kafka性能方面进行简单分析,相关数据请参考: https://segmentfault.com/a/1190000003985468 ,下面介绍一下Kafka的架构和涉及到的名词: Topic:用于划分Message的逻辑概念,一个Topic可以分布在多个Broker上。 Partition:是Kafka中横向扩展和一切并行化的基础,每个Topic都至少被切分为1个Partition。 Offset:消息在Partition中的编号,编号顺序不跨Partition。 Consumer:用于从Broker中取出/消费Message。 Producer:用于往Broker中发送/生产Message。 Replication:Kafka支持以Partition为单位对Message进行冗余备份,每个Partition都可以配置至少1个Replication(当仅1个Replication时即仅该Partition本身)。 Leader:每个Replication集合中的Partition都会选出一个唯一的Leader,所有的读写请求都由Leader处理

ZeroMQ、RabbitMQ、ActiveMQ

江枫思渺然 提交于 2020-05-05 10:17:52
【ZeroMQ】 ZeroMQ是一种基于消息队列的多线程网络库,其对套接字类型、连接处理、帧、甚至路由的底层细节进行抽象,提供跨越多种传输协议的套接字。 ZeroMQ是网络通信中的新的一层,结余应用层和传输层之间按照tcp/ip划分。是一个可伸缩层,并行运行,分散在分布式系统间。 ZeroMQ号称是“史上最快的消息队列”,基于c语言开发的,实时流处理sorm的task之间的通信就是用的zeroMQ 【RabbitMQ】 RabbitMQ是实现了高级消息队列协议(AMQP)的开源消息代理软件(亦称面向消息的中间件)。RabbitMQ服务器是用Erlang语言编写的,而群集和故障转移是构建在开放电信平台框架上的。所有主要的编程语言均有与代理接口通讯的客户端库。 【ActiveMQ】 Apache ActiveMQ是Apache软件基金会所研发的开放源代码消息中间件;由于ActiveMQ是一个纯Java程序,因此只需要操作系统支持Java虚拟机,ActiveMQ便可执行。 ActiveMQ是一种开源的基于JMS(Java Message Servie)规范的一种消息中间件的实现,ActiveMQ的设计目标是提供标准的,面向消息的,能够跨越多语言和多系统的应用集成消息通信中间件。 【ActiveMQ的两种消息传递类型】 1、点对点传输,一个生产者对应一个消费者,生产者向broke推送数据

4、定时任务关闭超时未支付的订单

泄露秘密 提交于 2020-05-03 18:54:42
// 1. 在主启动类上加上支持定时任务的注解 @EnableScheduling public class Application { // 2. 编写定时任务 @Component public class OrderJob { @Autowired private OrderService orderService; /** * 使用定时任务关闭超期未支付订单,会存在的弊端: * 1. 会有时间差,程序不严谨 * 10:39下单,11:00检查不足1小时,12:00检查,超过1小时多余39分钟 * 2. 不支持集群 * 单机没毛病,使用集群后,就会有多个定时任务 * 解决方案:只使用一台计算机节点,单独用来运行所有的定时任务 * 3. 会对数据库全表搜索,及其影响数据库性能:select * from order where orderStatus = 10; * 定时任务,仅仅只适用于小型轻量级项目,传统项目 * * 后续课程会涉及到消息队列:MQ-> RabbitMQ, RocketMQ, Kafka, ZeroMQ... * 延时任务(队列) * 10:12分下单的,未付款(10)状态,11:12分检查,如果当前状态还是10,则直接关闭订单即可 */ // @Scheduled(cron = "0/3 * * * * ?") // @Scheduled(cron =