Skip to content

Commit

Permalink
Implemented change to make sure producer and consumer names are unique
Browse files Browse the repository at this point in the history
  • Loading branch information
jbvanzuylen committed Dec 13, 2018
1 parent 697737e commit aa764a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import org.apache.pulsar.client.api.Consumer;
Expand Down Expand Up @@ -63,7 +64,7 @@ public void init(final ConsumerBuilder<byte[]> builder)
{
final PulsarConfiguration config = this.getGateway().getConfiguration();
builder.topic(config.getTopic());
builder.consumerName(this.getGateway().getId());
builder.consumerName(this.getGateway().getId() + "$" + UUID.randomUUID().toString().substring(0, 5));
builder.subscriptionName(config.getSubscriptionName());
builder.subscriptionType(config.getSubscriptionType());
builder.ackTimeout(config.getAckTimeout(), TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.primeoservices.cfgateway.pulsar;

import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import org.apache.pulsar.client.api.Producer;
Expand Down Expand Up @@ -63,7 +64,7 @@ public void init(final ProducerBuilder<byte[]> builder)
{
final PulsarConfiguration config = this.getGateway().getConfiguration();
builder.topic(config.getTopic());
builder.producerName(this.getGateway().getId());
builder.producerName(this.getGateway().getId() + "$" + UUID.randomUUID().toString().substring(0, 5));
builder.sendTimeout(config.getSendTimeout(), TimeUnit.SECONDS);
builder.enableBatching(false);
}
Expand Down

0 comments on commit aa764a8

Please sign in to comment.