message-queue

when does an AMQP/RabbitMQ channel with no connections die?

喜欢而已 提交于 2019-12-03 13:16:10
I have a simple RabbitMQ test program randomly enqueuing messages, and another reading them, all using Spring-AMQP. If the consumer dies (for example killing a process without having a chance to close its connection or channel), any messages that it had not acknowledged appear to remain unacknowledged forever. I have seen a number of references (for example this question ) that say that the channel dies when it has no connections, and that remaining unack'd messages will be redelivered. That's not the behaviour I see - instead I get a growing list of channels marked IDLE and a growing list of

Kafka: Cant Create Multiple Stream Consumers

南笙酒味 提交于 2019-12-03 13:05:02
I just got up and running with Kafka 0.8 beta 1. I have a really simple example up and running, the problem is, I can only get one message consumer to work, not several. That is, the runSingleWorker() method WORKS. The run() method DOES NOT WORK: import kafka.consumer.ConsumerIterator; import kafka.consumer.KafkaStream; import kafka.consumer.ConsumerConfig; import kafka.javaapi.consumer.ConsumerConnector; import java.util.Map; import java.util.List; import java.util.HashMap; import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; import org.springframework.context

Boost Message Queue not based on POSIX message queue? Impossible to select(2)?

可紊 提交于 2019-12-03 12:46:51
I thought I'd use Boost.Interprocess's Message Queue in place of sockets for communication within one host. But after digging into it, it seems that this library for some reason eschews the POSIX message queue facility (which my Linux system supports), and instead is implemented on top of POSIX shared memory. The interface is similar enough that you might not guess this right away, but it seems to be the case. The downside for me is that shared memory obtained via shm_open(3) does not appear to be usable with select(2) , as opposed to POSIX message queues obtained via mq_open(3) . It seems

How to selectively delete messages from an AMQP (RabbitMQ) queue?

久未见 提交于 2019-12-03 12:36:42
问题 I'd like to selectively delete messages from an AMQP queue without even reading them. The scenario is as follows: Sending side wants to expire messages of type X based on a fact that new information of type X arrived. Because it's very probable that the subscriber didn't consume latest message of type X yet, publisher should just delete previous X-type messages and put a newest one into the queue. The whole operation should be transparent to the subscriber - in fact he should use something as

Using POSIX message queues instead of TCP sockets - how to establish “connection”?

我是研究僧i 提交于 2019-12-03 11:40:44
问题 I have client and server programs which now communicate via TCP. I'm trying out using POSIX message queues instead (in cases where the client and server are on the same machine, of course). My hope is that it will improve performance (specifically via reduced latency). I've worked out most of it, but am not sure about one thing: how to establish the "connection." The server accepts connections from multiple clients concurrently, so I'm tempted to emulate the TCP connection establish process

How to implement a competing consumer solution?

此生再无相见时 提交于 2019-12-03 11:36:50
As a exercise I'm trying to find an example which implements competing consumer. many producers - > MSMQueue <- competing consumers So far I did not find any documentation on how to achieve this. My first attempt to figure out how is implemented in MassTransit or NServiceBus failed to many layers of indirection. Any help will be greatly appreciated. Cocowalla With MassTransit and MSMQ you can achieve this using the Distributor component. Note that if you use MassTransit with RabbitMQ instead of MSMQ, you can implement a competing consumer scenario without using the Distributor, simply by

Count number of messages in a JMS queue

雨燕双飞 提交于 2019-12-03 10:48:41
What is the best way to go over a JMS queue and get all the messages in it? How can count the number of messages in a queue? Thanks. Using JmsTemplate public int getMessageCount(String messageSelector) { return jmsTemplate.browseSelected(messageSelector, new BrowserCallback<Integer>() { @Override public Integer doInJms(Session s, QueueBrowser qb) throws JMSException { return Collections.list(qb.getEnumeration()).size(); } }); } sunleo This is how you can count No of Messages in a Queue public static void main(String[] args) throws Exception { // get the initial context InitialContext ctx = new

Event-sourcing: when (and not) should I use Message Queue?

自古美人都是妖i 提交于 2019-12-03 10:42:49
问题 I am building a project from scratch using event-sourcing with Java and Cassandra. My apps we be based on microservices and in some use cases information will be processed asynchronously. I was wondering what part a Message Queue (such as Rabbit, Active MQ Artemis, Kafka, etc) would play to improve the technology stack in this environment and if I understand the scenarios if I won't use it. 回答1: I would start with separating messaging infrastructure like RabbitMQ from event streaming/storing

Mock or simulate Message Queue (JMS)

这一生的挚爱 提交于 2019-12-03 09:27:11
问题 There is a message(text), which format and content i definitely know. For now,class in Java,that parses and reads this message from file,is implemented. In real world, this message will come from Message Queue. For now I should simulate, mock or generate Message Queue on my local PC for testing purposes. Java spec(java jms): JMS provider: A messaging system that implements the JMS specification. JMS clients: Java applications that send and receive messages. Messages: Objects that are used to

How to retract a message in RabbitMQ?

懵懂的女人 提交于 2019-12-03 09:06:29
问题 I've got something like a job queue over RabbitMQ and, upon a request to cancel a job, I'd like to retract the tasks that have not yet started processing (their messages have not been ack'd), which corresponds to retracting these messages from the queues that they've been routed to. I haven't found this functionality in AMQP or in the RabbitMQ API; perhaps I haven't searched well enough? Or will I have to use a workaround (it's not hard, but still)? 回答1: I would solve this scenario by having