producer

Producer/consumer system using database (MySql), is this feasible?

╄→尐↘猪︶ㄣ 提交于 2019-12-13 11:42:57
问题 I need to use something to coordinate my system with several consumers/producers each running on different machines with different operating systems. I have been researching on using MySql to do this, but it seems ridiculously difficult. My requirements are simple: I want to be able to add or remove consumers/producers at any time and thus they should not depend on each other at all. Naturally a database would separate the two nicely. I have been looking at Q4M message queuing plugin for

File Copy Tool w/ Producer/Consumer Model

眉间皱痕 提交于 2019-12-13 05:24:03
问题 so I was looking over my next school assignment, and I'm baffled. I figured I would come to the experts for some direction. My knowledge on synchronization is severely lacking, and I didn't do so hot on the "mcopyfile" assignment it refers to. Terrible would probably be a good word for it. If I could get some direction on how to accomplish this problem, it would be much appreciated. Not looking for someone to do my assignment, just need someone to point me in the right direction. baby steps.

CDI - Producers and Qualifiers not on the produced object

你离开我真会死。 提交于 2019-12-12 01:24:22
问题 imagine having a producer for a SessionFactory (as example): @Produces public SessionFactory produceSessionFactory(){} No I have a second producer that produces some other object, lets say a DatabaseObject, and needs a reference to a SessionFactory: @Produces public DatabaseObject produceDatabaseObject(SessionFactory factory){} No I can use my database object like that: @Inject DatabaseObject object; So far, so good. So lets assume this stuff is implemented in a framework and is going to be

Java Threads Producer Consumer Algorithm not working properly

[亡魂溺海] 提交于 2019-12-10 17:54:17
问题 I am trying to learn threads and hence I wrote a sample producer consumer problem wherein the producer produces numbers from 1 to 10 and the consumer has to display them. But only the consumer displays number 1 and stops. As I said the program is not well written and might be absurd but still I want to figure out the reason why all the numbers from 1 to 10 are not printed as I will remembr best when I code rather than from examples. I am using two varibales to track the completion of the

How to call procedure in kohana 3.1

左心房为你撑大大i 提交于 2019-12-08 09:41:46
问题 Kohana is a php framework. this is the documention . how to call procedure in this framework. i have searched and questions about this question. like : insert_id in Kohana 3 this is my code : $conn = Database::instance(); $queryStr = "call sp_createUser('$nick_name','$email','$password','127.0.0.1')"; $query = DB::query(Database::SELECT, $queryStr); $query->execute($conn); but there's some exception.. Database_Exception [ 1312 ]: PROCEDURE sp_createUser can't return a result set in the given

java concurrency: multi-producer one-consumer

假装没事ソ 提交于 2019-12-05 00:43:45
问题 I have a situation where different threads populate a queue (producers) and one consumer retrieve element from this queue. My problem is that when one of these elements are retrieved from the queue some is missed (missing signal?). The producers code is: class Producer implements Runnable { private Consumer consumer; Producer(Consumer consumer) { this.consumer = consumer; } @Override public void run() { consumer.send("message"); } } and they are created and run with: ExecutorService executor

Topic can't be found when producing messages: UNKNOWN_TOPIC_OR_PARTITION

给你一囗甜甜゛ 提交于 2019-12-04 19:34:57
问题 I have a two-nodes kafka cluster (EC2 instances) where each node is used as a separate broker. When I run a producer on the leader instance with the following command: kafka-console-producer.sh --broker-list localhost:9092 --topic test I get the following errors. test message [2017-01-09 13:22:39,483] WARN Error while fetching metadata with correlation id 0 : {test=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient) [2017-01-09 13:22:39,562] WARN Error while fetching metadata

Jafka源码粗略解读之三-producer

故事扮演 提交于 2019-12-04 03:19:31
资料 今天看到研究Jafka的人还挺多的,比较优秀的是@FrankHui的 Kafka系列文章 ,还有@rockybean 的 博客 。这两个博客都写的很详细,条理清晰,图文并茂,比起我这种走马观花,笔记式的记录要好得多了。 不过其实读源码每个人侧重点都不同,我还是继续记录我的。 作为一个实用主义者,我觉得读源码有几种目的: 实际使用到该项目,想要弄清其原理,乃至于需要做定制化的 想要学习其设计方法、架构思想的 想要学习到一些代码实现上的技巧 因为项目中也没有用到Jafka,而是公司内部基于mongodb和netty写的一个MQ,其实我倒是更倾向于3和2,然后再带着想法回头改进自己的。既然已经写了是粗略解读,倒是不怕人指责了。 代码 Producer的入口可以看 ProducerTest 类。 根据配置,send()可以使用sync和async方式。 BlockingChannel 是封装了网络连接的类,底层是NIO的 SocketChannel 。 这里颇有意思的是 BlockingChannel 的 send 方法: <!-- lang: java --> public int send(BoundedByteBufferSend bufferSend) throws IOException { if (!isConnected()) { throw new

Spring Kafka asynchronous send calls block

耗尽温柔 提交于 2019-12-03 17:02:13
问题 I'm using Spring-Kafka version 1.2.1 and, when the Kafka server is down/unreachable, the asynchronous send calls block for a time. It seems to be the TCP timeout. The code is something like this: ListenableFuture<SendResult<K, V>> future = kafkaTemplate.send(topic, key, message); future.addCallback(new ListenableFutureCallback<SendResult<K, V>>() { @Override public void onSuccess(SendResult<K, V> result) { ... } @Override public void onFailure(Throwable ex) { ... } }); I've taken a really

java concurrency: multi-producer one-consumer

℡╲_俬逩灬. 提交于 2019-12-03 16:06:35
I have a situation where different threads populate a queue (producers) and one consumer retrieve element from this queue. My problem is that when one of these elements are retrieved from the queue some is missed (missing signal?). The producers code is: class Producer implements Runnable { private Consumer consumer; Producer(Consumer consumer) { this.consumer = consumer; } @Override public void run() { consumer.send("message"); } } and they are created and run with: ExecutorService executor = Executors.newSingleThreadExecutor(); for (int i = 0; i < 20; i++) { executor.execute(new Producer