message-queue

posix pipe as a work queue

霸气de小男生 提交于 2019-12-21 05:27:04
问题 The normal implementations of a work queue I have seen involve mutexes and condition variables. Consumer: A) Acquires Lock B) While Queue empty Wait on Condition Variable (thus suspending thread and releasing lock) C) Work object retrieved from queue D) Lock is released E) Do Work F) GOTO A Producer: A) Acquires Lock B) Work is added to queue C) condition variable is signaled (potentially releasing worker) D) Lock is released I have been browsing some code and I saw an implementation using

Confused as to when you would use JMS (or a queue in general) versus a database

安稳与你 提交于 2019-12-21 04:27:20
问题 When you store a message in a queue, isn't it more of meta data information so whoever pulls from the queue knows how to process the data? the actual information in the queue doesn't always hold all the information. Say you have an app like Twitter, whenever someone posts a message, you would still need to store the actual message text in the database correct? The queue would be more used to broadcast to other subscribers that a new message has arrived, and then those services could take

Queue using table

心不动则不痛 提交于 2019-12-21 02:58:07
问题 I need to implement a queue using table. The business requirement is to have a single queue which will be accessed by 5-10 boxes to get the next job/jobs. There will not be more than 5000 jobs per day. Also, a batch of jobs should be "dequeued" at one time. Just wondering what are the problem areas and issues I might run into as I havent done it before. If anyone has faced this/done this before, can you please point me to a design/sample implementation or issues that need to be taken care of.

How to schedule emails to send out

試著忘記壹切 提交于 2019-12-21 02:14:01
问题 Using PHP, I have a query that goes through my DB looking for pending tasks with reminder triggers at certain times of the day. I have a cronjob that runs every 10 mins and checks the DB for any rows that has "remind_me" field set to go off within the next 10 mins. If it does find something, what's the best way to queue an email with the task information? I guess I'll need some sort of message queue system, but how does the email part work? Will I need another cronjob that runs every minute

PHP + MySQL Queue

天大地大妈咪最大 提交于 2019-12-20 10:56:06
问题 I need a simple table that acts as a Queue. My MySQL server restriction is I can't use InnoDB tables, only MyISAM. Clients/workers will work at the same time and they will need to receive differents jobs each time. My idea is to do the following (pseudo-code): $job <- SELECT * FROM queue ORDER BY last_pop ASC LIMIT 1; UPDATE queue SET last_pop WHERE id = $job->id return $job I had tried table lock and "GET_LOCK" but nothing happends, workers sometimes receives same jobs. 回答1: You need to turn

Difference between Apache Thrift and ZeroMQ

谁都会走 提交于 2019-12-20 08:48:37
问题 I understand that Apache Thrift and ZeroMQ are softwares belonging to different categories, and it is not easy to do a comparison since it is an apple to orange comparison. But I don't know why they belong to different categories. Aren't they both used to pass data between different services, which may or may not be written in different languages? When should I use Thrift and when should I use a message queue? 回答1: They belong to different categories primarily because they are targetted at

How to implement distributed processing [closed]

吃可爱长大的小学妹 提交于 2019-12-20 07:12:26
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I have requests coming in for different samples (s1, s2, ..) that need to be processed in a linear fashion (i.e. only one say s1-request at the time can be processed). I have N-number of worker services that can process given requests. How can I implement rpc-queue pattern so that

Python execute threads by order

落花浮王杯 提交于 2019-12-20 05:43:19
问题 I have the following code: import threading def send_to_server(lst): #Some logic to send the list to the server. while 1: lst = [] for i in range(1000): lst.append(i) task = threading.Thread(target=send_to_server,args(copy(lst),)) task.start() I have a few Questions: 1) The idea for using threads is because sending to server takes time and I want to continue generating the data without any stop. The problem with this code is that if I created thread #3 and its taking long time to process, By

Android 2.1: Muliple Handlers in a Single Activity

女生的网名这么多〃 提交于 2019-12-19 10:27:21
问题 I've more than one Handlers in an Activity. I create all the handlers in the onCreate() of the main activity. My understanding is the handleMessage() method of each handler will never be called at the same time because all messages are put in the same queue (the Activity thread MessageQueue). Therefore, they will be executed in the order in which are put into the Queue. They will also be executed in the main activity thread. Is this correct ? public void onCreate() { this.handler1 = new

Timer Queue in Windows Service

♀尐吖头ヾ 提交于 2019-12-19 09:44:01
问题 For a Windows Service, I need a timer to perform a certain task regularly. Of course, there are many options that seem superior to a timer (multithreading, calling method directly from the service's main thread), but they all have their disadvantages in this particular situation. However, for obvious reasons, SetTimer() does not work without the message queue of a GUI. What I have done (in Free Pascal) is the following: Create the timer: MyTimerID := SetTimer(0, 0, 3333, @MyTimerProc); In the