@Override
    public void publish(Object payload, DynamicOptions transportOptions, Integer destinationId, State s)
            throws ConnectionUnavailableException {
        try {
            transportOptions.setVariableOptionIndex(destinationId);
            sink.publish(payload, transportOptions, s);
        } catch (ConnectionUnavailableException e) {
            sink.setConnected(false);
            strategy.destinationFailed(destinationId);
            log.warn("Failed to publish payload to destination ID " + destinationId + ".", e);
            sink.connectWithRetry();
            throw e;
        }
    }
This class implements a the distributed sink that could publish to multiple destination using a single
client/publisher. Following are some examples,
- In a case where there are multiple partitions in a single topic in Kafka, the same kafka client can be used
to send events to all the partitions within the topic.
- The same email client can send email to different addresses.
modules/siddhi-core/src/main/java/io/siddhi/core/util/transport/SingleClientDistributedSink.java