Class XTablesMessageQueue

java.lang.Object
java.lang.Thread
org.kobe.xbot.JServer.BaseHandler
org.kobe.xbot.JServer.XTablesMessageQueue
All Implemented Interfaces:
Runnable

public class XTablesMessageQueue extends BaseHandler
XTablesMessageQueue - A handler class for managing JeroMQ-based messaging queues.

This class initializes and manages the components required for handling message queues using JeroMQ. It leverages a blocking queue for message buffering and operates in a multithreaded environment.

Author: Kobe Lei Version: 1.0 Package: org.kobe.xbot.JServer

This is part of the XTABLES project and facilitates efficient message processing and publication in real-time applications.

  • Constructor Details

    • XTablesMessageQueue

      public XTablesMessageQueue(org.zeromq.ZMQ.Socket socket, XTablesServer instance)
      Constructor for initializing the XTablesMessageQueue.

      This constructor sets up the handler thread with a specified name, daemon mode, and the provided JeroMQ socket. It also initializes a blocking queue to buffer messages for asynchronous processing.

      Parameters:
      socket - The ZeroMQ socket to receive and send messages
  • Method Details

    • send

      public void send(byte[] message)
      Adds a message to the queue for asynchronous processing.

      This method places the provided message into the blocking queue. If the queue is full, the message will be rejected silently.

      Parameters:
      message - The byte array message to enqueue for processing
    • run

      public void run()
      The main processing loop for handling incoming messages.

      This method continuously retrieves messages from the blocking queue and sends them through the JeroMQ socket. The loop runs until the thread is interrupted. Any exception encountered is passed to the handler's exception processor.

      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread