Should the FlowReceiver be closed before recreating a new FlowReceiver?

Options
SeanTYH
SeanTYH Member Posts: 12 ✭✭
edited October 2023 in General Discussions #1

I am following along with this solace tutorial. https://tutorials.solace.dev/jcsmp/message-replay/ I am now testing and handling this portion of the tutorial where I handle REPLAY_START_TIME_NOT_AVAILABLE: https://tutorials.solace.dev/jcsmp/message-replay/#:~:text=REPLAYSTARTTIMENOTAVAILABLE%20is%20handled%20by%20adjusting%20ReplayStartLocation%20to%20replay%20all%20logged%20messages. .

I have added a System.out.println(consumer.isClosed()); before I recreate a new FlowReceiver to replay from the beginning. This is printing out false.

consumerFlowProperties.setReplayStartLocation(JCSMPFactory.onlyInstance().createReplayStartLocationBeginning());

System.out.println(consumer.isClosed());

consumer = session.createFlow(this, consumerFlowProperties, null, replayFlowEventHandler);

consumer.start();

Should I close this FlowReceiver before instantiating a new FlowReceiver? I am concerned that leaving a FlowReceiver open throughout the lifecycle of the application could be wasting resources of some sort.

Tagged:

Best Answer

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 921 admin
    #2 Answer ✓
    Options

    Hi @SeanTYH,

    I think you may have found a bug in the documentation/tutorial. I'll follow up on that to get it resolved, but in the mean time if you are seeing it is still open I would recommend closing it before you open a new one.

    thanks,

    Marc

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 921 admin
    #3 Answer ✓
    Options

    Hi @SeanTYH,

    I think you may have found a bug in the documentation/tutorial. I'll follow up on that to get it resolved, but in the mean time if you are seeing it is still open I would recommend closing it before you open a new one.

    thanks,

    Marc