Class PushResolver

java.lang.Object
com.iizix.server.push.engine.PushResolver

public final class PushResolver extends Object
The resolver: (application, user, Topic, [area]) -> List<DeliveryTarget>.

Location filters; method is a property of each target. A resolution collects every way the user can be reached for the application and Topic - each stored subscription as a device target with its transport, each live session as an in-session target - then filters that set by the requested area. A caller never asks for "FCM in Africa": it asks for Africa and dispatches to whatever comes back.

Exact for a session, best-effort for a token. A live session's location is resolved now from the connection's real remote address. A stored subscription's location is the address the device last presented to this server, resolved when the device was last seen and remembered in the row; the device may have moved since. A regional send is therefore not a guarantee for an offline device, and every target says which kind it is (DeliveryTarget.isExactLocation()).

Unknown location. With no area requested a target of unknown location is served locally. With an area requested, an unknown location is decided by the residency policy: ResidencyPolicy.MUST rejects it as DeliveryOutcome.UNRESOLVABLE_RESIDENCY, the other two include it and log the assumption.

In-session targets are produced only while IInSessionDelivery.isAvailable() is true, i.e. after ORDER 3; the enumeration path is in place and dormant.

Author:
Christopher Mindus
  • Constructor Details

  • Method Details

    • getTree

      public com.iizix.server.push.engine.FlatRegionTree getTree()
      Gets the tree.
      Returns:
      The region tree.
    • resolve

      public List<DeliveryTarget> resolve(String appId, long uid, String topic, IRegionScope area) throws SQLException
      Resolves the targets of one user for an application and Topic, filtered by an area.
      Parameters:
      appId - The application ID; * matches every application.
      uid - The user ID.
      topic - The Topic; empty matches every Topic.
      area - The area, null or unrestricted for anywhere.
      Returns:
      The targets, the filtered-out ones omitted.
      Throws:
      SQLException - For store errors.
    • plan

      public RoutingPlan plan(SubscriptionFilter filter, IRegionScope authorization, ResidencyPolicy residency, DeliveryMode mode, String topic) throws SQLException
      Builds the routing plan of a send: every target the filter matches, in its region's slice or in the rejected bucket with its reason.
      Parameters:
      filter - The filter.
      authorization - The operator's authorization scope.
      residency - The effective residency policy.
      mode - The effective delivery mode.
      topic - The Topic an in-session target is for, when the filter names one Topic; empty otherwise.
      Returns:
      The plan.
      Throws:
      SQLException - For store errors.