DCP event issue when Start streaming again

Hi,

I have create DCP client connection in my Java application. And start and stop streaming on some conditions.

Example code,

//Creatin client and start streaming
Client client = Client.builder()
                .credentials("Administrator", "password")
                .seedNodes("127.0.0.1")
                .bucket("travel-sample")
                .build()) {

client.connect().block();
client.initializeState(StreamFrom.NOW, StreamTo.INFINITY).block();
client.startStreaming().block();

Conditional code in other place,


if (STOP) {
 client.stopStreaming(Collections.emptyList()).block();
}      

if (START) {    
   client.startStreaming(Collections.emptyList()).block();
}

Problem,

Getting below exception when start streaming again.

Sequence Number 18352 is not within snapshot [18353 - 18353]
stacktrace: [com.couchbase.client.dcp.highlevel.StreamOffset.<init>(StreamOffset.java:40),
com.couchbase.client.dcp.state.PartitionState.getOffset(PartitionState.java:256),
com.couchbase.client.dcp.Client.lambda$startStreaming$9(Client.java:595),

Please help me on above exception. how I can resolved.

Thanks

Bhushan Phalak

Hi @bphalak !

I have to start with an obligatory disclaimer than the DCP protocol and client libraries are not officially supported.

  1. What version of the Java DCP client are you using?
  2. Can you please explain why you want to stop/resume streaming?

In general, I would recommend closing the DCP client, and creating a new client when you’re ready to resume streaming.

An example in the GitHub repo shows how to track offsets and resume from a saved offset.

Thanks,
David

1 Like

Hi David,

Thanks for reply

DCP client - 0.37.0

CB Java Client - 3.3.0

Scenario - In our application we have given client facility to start and stop evening if they required.

Thanks

This might be a symptom of JDCP-241, which was resolved in Java DCP client 0.48.0.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.