Class EsbPublisher

java.lang.Object
com.kingsrook.qqq.esb.publish.EsbPublisher

public final class EsbPublisher extends Object
Sends ESB events to a destination (spec section 5): one PERSISTENT JMS TextMessage per event, all on one session. Each publish call leases one transacted session on the destination's provider (whose connection EsbConnectionManager keeps open), sends every event, and commits once. So a call sends all of its events or none of them, and a bulk write's thousands of messages wait on the broker once, at the commit, rather than once per message. publish never throws. A failure (unknown destination, no QInstance in context, broker down or its client missing, an event that can't be written) is logged, counted once per event with EsbStats.publishFailed, and returned in the output - so a failed publish can't fail the record write or process that asked for it. Sent messages are counted with EsbStats.published. Destinations are looked up (and a provider's first connection is made) from the QContext's instance, so call it with a QContext.
  • Method Details

    • getInstance

      public static EsbPublisher getInstance()
      Get the singleton instance.
    • publish

      public EsbPublishOutput publish(String destinationName, List<EsbEvent> events)
      Send the events, in order, to the destination (by its QQQ name). No events (null or empty) is a success that sends nothing. Never throws - see the class comment.