Interface TransactionalPacketRegistry

All Superinterfaces:
PacketRegistry
All Known Subinterfaces:
BasicPacketChannel, PacketChannel

public interface TransactionalPacketRegistry extends PacketRegistry
A registry for packets and their bindings. Also supports transactional packets.
  • Method Details

    • registerTransactional

      <P extends RequestPacket<R>, R extends Packet> FixedTransactionalPacketBinding<P,R> registerTransactional(Class<P> requestPacketType, Class<R> responsePacketType, int packetOpcode)
      Register a request/response packet class pair to this channel. A receiving handler isn't required when sending the request using TransactionalPacketDispatcher.sendTo(EngineConnection, RequestPacket).

      The response packet type may be reused by multiple request types.

      Type Parameters:
      P - The type of the request packet
      R - The type of the response packet
      Parameters:
      packetOpcode - A unique opcode for this request/response packet type pair
      requestPacketType - The type of the request packet being registered
      responsePacketType - The type of the response packet being registered
      Returns:
      The created transactional packet binding
    • registerTransactional

      <P extends RequestPacket<R>, R extends Packet> TransactionalPacketBinding<P,R> registerTransactional(Class<P> requestPacketType, int packetOpcode)
      Register a request packet class pair to this channel. A receiving handler isn't required when sending the request using TransactionalPacketDispatcher.sendTo(EngineConnection, RequestPacket).

      Unlike packets registered using registerTransactional(Class, Class, int), multiple response packet types are allowed for the request type. But they need to be registered using PacketRegistry.register(Class, int).

      Type Parameters:
      P - The type of the request packet
      R - The type of the response packet
      Parameters:
      packetOpcode - A unique opcode for this request packet type
      requestPacketType - The type of the request packet being registered
      Returns:
      The created transactional packet binding
    • transactionalBinding

      <P extends RequestPacket<R>, R extends Packet> Optional<TransactionalPacketBinding<P,R>> transactionalBinding(Class<P> requestPacketType)
      Gets the TransactionalPacketBinding for the given RequestPacket class, if the type is registered to this channel as a transactional binding.
      Type Parameters:
      P - The type of the request packet
      R - The type of the response packet
      Parameters:
      requestPacketType - The request packet type
      Returns:
      The transactional packet binding, if found