forked from hobbit-project/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom Consumer class for issue hobbit-project#45
- Loading branch information
1 parent
5c5520f
commit d86827f
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.hobbit.core.rabbit; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.LinkedBlockingQueue; | ||
|
||
import com.rabbitmq.client.AMQP; | ||
import com.rabbitmq.client.Channel; | ||
import com.rabbitmq.client.DefaultConsumer; | ||
import com.rabbitmq.client.Delivery; | ||
import com.rabbitmq.client.Envelope; | ||
public class CustomConsumer extends DefaultConsumer { | ||
|
||
public LinkedBlockingQueue<Delivery> deliveryQueue = new LinkedBlockingQueue<>(); | ||
public CustomConsumer(Channel channel) { | ||
super(channel); | ||
} | ||
@Override | ||
public void handleDelivery(String consumerTag, | ||
Envelope envelope, | ||
AMQP.BasicProperties properties, | ||
byte[] body) | ||
throws IOException | ||
{ | ||
deliveryQueue.add(new Delivery(envelope,properties,body)); | ||
} | ||
} |