Class ParallelPublisher

java.lang.Object
com.iohao.net.common.ParallelPublisher
All Implemented Interfaces:
Publisher

public final class ParallelPublisher extends Object implements Publisher
Parallel multi-threaded Publisher implementation with per-publication virtual threads.

Each publication runs on its own virtual thread, eliminating head-of-line blocking between different publications and improving throughput under concurrent load. Messages sent to the same publication maintain FIFO ordering, while different publications can publish in parallel.

Use this implementation when you have multiple publications with high message rates and want to maximize throughput by parallelizing publication work.

Since:
25.1
Author:
渔民小镇
date:
2026-03-01
  • Constructor Details

    • ParallelPublisher

      public ParallelPublisher()
  • Method Details

    • addPublication

      public void addPublication(String name, io.aeron.Publication publication)
      Description copied from interface: Publisher
      Adds a named Aeron publication target.
      Specified by:
      addPublication in interface Publisher
      Parameters:
      name - publication name
      publication - Aeron publication
    • publishMessage

      public void publishMessage(String name, Object message)
      Description copied from interface: Publisher
      Enqueues a message for publication.
      Specified by:
      publishMessage in interface Publisher
      Parameters:
      name - publication name
      message - message to publish
    • startup

      public void startup()
      Description copied from interface: Publisher
      Starts background publishing resources.
      Specified by:
      startup in interface Publisher
    • shutdown

      public void shutdown()
      Description copied from interface: Publisher
      Stops background publishing resources.
      Specified by:
      shutdown in interface Publisher