Skip to content

Commit

Permalink
Custom Consumer class for issue hobbit-project#45
Browse files Browse the repository at this point in the history
  • Loading branch information
altafhusen-mr committed Nov 10, 2019
1 parent 5c5520f commit d86827f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>4.8.0</version>
<version>5.7.3</version>
</dependency>
<!-- Jena -->
<dependency>
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/org/hobbit/core/rabbit/CustomConsumer.java
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));
}
}

0 comments on commit d86827f

Please sign in to comment.