messaging

Which rpc/messaging framework would best fit this case?

大憨熊 提交于 2019-12-12 12:12:37
问题 Use case : one Java process with one or two C++ processes, always on the same machine. Bidirectional, binary, non-persistent communication is required. One of the C++ process is responsible for instantiating the other processes. I have given a look around, seeing things like XML/JSON-RPC, Protocol Buffers, Thrift, zeromq, etc. If possible, portability would be nice, but Windows XP/7 is required. 回答1: In general you should separate message transport and message de-/serialization in your design

Pause a thread for less than one millisecond

£可爱£侵袭症+ 提交于 2019-12-12 09:32:32
问题 In a messaging client test application, the producer thread needs to be throttled to avoid flooding the server. As the transfer rates are around 25,000 messages per second (40 microseconds per message), the delay caused by Sleep(1) would far too long. How to make thread sleep less than a millisecond on Windows contains some information related to the Windows API. Is there a code snippet, class or library for Delphi? Following Bens answer I found that Sleep with different values below 15 also

ActiveMQ: starting consumer without broker

狂风中的少年 提交于 2019-12-12 09:06:22
问题 I am writing a JMS client that consumes from a Queue. My broker is activemq, if it matters. One requirement is that the client should start even if the broker is down. In that case it should behave as if there where no messages in the Queue, and once the broker is up and messages start coming behave accordingly. The problem is that in my code: connectionFactory = new ActiveMQConnectionFactory(url); Connection connection = connectionFactory.createConnection(); connection.start() If the broker

Kafka Java consumer never receives any messages

こ雲淡風輕ζ 提交于 2019-12-12 08:09:22
问题 I'm trying to setup a basic Java consumer to receive messages from a Kafka topic. I've followed the sample at - https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example - and have this code: package org.example.kafka.client; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import kafka.consumer.ConsumerConfig; import kafka.consumer.KafkaStream;

The correct way to pass data to/from a java HttpHandler class for java HttpServer class

删除回忆录丶 提交于 2019-12-12 03:42:14
问题 I have a java HttpHandler that I am using to test an application. In the HttpHandler each http request is handled in a separate thread and is passed the HttpExchange. But I need to access data from the main thread and class (the one that setup the HttpServer and HttpHandler) so that HttpHandler can send back the correct response for the current test being run. How is the best way to get this data passed in or accessible by the HttpHandler class? I cannot add another parameter to the

Which of the following data duplication options across shards is recommended?

蓝咒 提交于 2019-12-12 02:54:16
问题 High performance mysql book suggests that for sharding a blog application, one may want to put comments data across 2 shards: first, on the shard of a person posting comment, and on the shard where the post is stored. So this raises the question how to reliably duplicate this data. Which of the following data duplication options across shards is recommended? Option 1: Make 2 separate inserts from the PHP script. Pros: a) Logic is in application layer. Cons: a) User is held for 2 inserts. b)

JMS Acknowledge Asynchronous Message

匆匆过客 提交于 2019-12-12 02:34:44
问题 How do I acknowledge a message when I am using a message listener? I get the following error when I try to do an acknowledge in my message listener. A synchronous method call is not permitted when a session is being used asynchronously: 'acknowledge' 回答1: You're talking about JMS messages acknowledgement as in Message.acknowledge()? That error seems a little odd. If you aren't using transactions or auto-acknowledge, I'd think you need to call that method. And if you're doing async listening,

Sails.js: Subscribing a User to specific actions on a Request

情到浓时终转凉″ 提交于 2019-12-12 01:58:46
问题 In my Sails project, I have a User model/controller and a Request model/controller, as well as a Dashboard controller. A user can make a request for data using RequestController.create , and an administrator can approve it using RequestController.grant . What I want to do is to notify a user whenever one of his/her requests is approved (updated). In RequestController.grant , I call Request.publishUpdate(...) , and in my DashboardController.display , I call Request.find(req.session.user.id,

Implement cross extension message passing in chrome extension and app

烈酒焚心 提交于 2019-12-11 18:58:10
问题 I am trying to do cross extension message passing between chrome extension and chrome app according to this article. But I am not sure that how to do it correctly. I used background js to receive and send messages. But no clue whether it is working or not. Actually I want to save file from chrome extension, since it cannot be done I thought this could work. So any idea or suggestion or example is highly welcome. I have go through many alternatives as also appears in this question. Then one of

SQL - need a query to get most recent message in each thread that a user is part of

三世轮回 提交于 2019-12-11 18:04:20
问题 In my app, a "message thread" is defined as all messages between two or more users, and is not nested. It needs to work like Facebook messages. I need a query that generates a list of all "message threads" in which a user is a member, sorted by threads with the most recent activity, descending. The result is a table of distinct threads, where each row contains the threadID, postDate and messageBody. Here's my schema: MessageThreads (threadID, lastPostDate) MessageThreadUsers (threadFK, userFK