Record Class MemoryFilter.Exclude

Object
Record
akka.javasdk.agent.MemoryFilter.Exclude
Record Components:
ids - the set of agent component IDs to exclude messages from
roles - the set of agent roles to exclude messages from
All Implemented Interfaces:
MemoryFilter
Enclosing interface:
MemoryFilter

public static record MemoryFilter.Exclude(Set<String> ids, Set<String> roles) extends Record implements MemoryFilter
Filter that excludes messages from agents with the specified component IDs or roles.

This filter uses OR logic for exclusion: a message is excluded if either its component ID is in the ids set OR its agent role is in the roles set. A message is excluded only if any conditions are met:

When multiple Exclude filters are chained together using MemoryFilter, they are automatically merged into a single Exclude filter with the union of all IDs and roles.

Example: An Exclude filter with ids={"agent-1"} and roles={"worker"} will exclude:

  • All messages from "agent-1" (regardless of role)
  • All messages with a role "worker" (regardless of component ID)

Messages that don't match any of these exclusion criteria are included. Messages with no agent role are only excluded if their component ID is in the ids set.

  • Constructor Details

    • Exclude

      public Exclude(Set<String> ids, Set<String> roles)
      Creates an instance of a Exclude record class.
      Parameters:
      ids - the value for the ids record component
      roles - the value for the roles record component
  • Method Details

    • merge

    • agentId

      public static MemoryFilter agentId(String id)
    • agentIds

      public static MemoryFilter agentIds(Set<String> ids)
    • agentRole

      public static MemoryFilter agentRole(String role)
    • agentRoles

      public static MemoryFilter agentRoles(Set<String> roles)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • ids

      public Set<String> ids()
      Returns the value of the ids record component.
      Returns:
      the value of the ids record component
    • roles

      public Set<String> roles()
      Returns the value of the roles record component.
      Returns:
      the value of the roles record component