com.solacesystems.jcsmp.ClosedFacilityException: Tried to perform operation on a closed XML message

Suneel
Suneel Member Posts: 1
edited August 2021 in General Discussions #1

Hi,
Can someone advise on below error ?
com.solacesystems.jcsmp.ClosedFacilityException: Tried to perform operation on a closed XML message producer

one of the publisher flow in our app sends only few messages in a day. Would keepAlive config solve this problem ? I already have reconnect config in place.

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 914 admin

    Hey @Suneel,

    I think you're correct to check the keepalive configuration. The message producer shouldn't just disconnect due to infrequent use. If you can re-produce in a dev/test environment I would also recommend enabling debug logging to get more info about what is going on.

    Hope that helps

  • TomF
    TomF Member, Employee Posts: 406 Solace Employee

    Hi @Suneel, could you also check your session and flow event handlers? It's possible you've had a session or flow event indicating that the session or flow had been closed, and the error notification will tell you why. You may already have this configured, just looking to check...

    For instance, if you're creating your publisher flow with:

    session.getMessageProducer(...)

    You'll need to provide an error handler. From the SolaceSample QueueProducer.java:

    final XMLMessageProducer prod = session.getMessageProducer(
    new JCSMPStreamingPublishEventHandler() {
    @Override
    public void responseReceived(String messageID) {
    System.out.printf("Producer received response for msg ID #%s%n",messageID);
    }
    @Override
    public void handleError(String messageID, JCSMPException e, long timestamp) {
    System.out.printf("Producer received error for msg ID %s @ %s - %s%n",
    messageID,timestamp,e);
    }
    });

    What's nice about this sample is it will give you more details on why you got the ClosedFacilityException.