Class FederationUpstream

java.lang.Object
org.acemq.rabbitmq.admin.FederationUpstream

public final class FederationUpstream extends Object
Another broker this one may federate from.

An upstream on its own does nothing. It names a broker and how to connect to it; what actually links anything is a policy whose definition carries federation-upstream or federation-upstream-set. Declaring an upstream and expecting messages to flow is the most common way federation appears not to work, and nothing reports it because nothing is wrong — you described a broker and never asked for anything from it.

Federation is not a shovel

They are easy to confuse and behave differently in the way that matters:

  • A shovel consumes from the source. A message it moves is gone from where it was.
  • Federation on an exchange copies: the upstream's subscribers still get the message, and so do yours.

So federation is for fanning a stream of events out to another site, and a shovel is for moving a queue's contents somewhere else — which is what a migration wants.

The URI carries credentials

amqp://user:password@host. That is how the broker stores it and how the management API returns it, so this object holds a password whether anybody wanted it to or not. toString() redacts it. uri() does not, because a caller comparing two upstreams needs the real value — so do not log the result.

  • Method Details

    • name

      public String name()
      Returns:
      what this upstream is called, and what a policy refers to it by
    • vhost

      public String vhost()
      Returns:
      the virtual host the upstream is defined in
    • uri

      public String uri()
      Returns:
      the connection URI, including any credentials in it. Needed to compare two upstreams; never log the result
    • redactedUri

      public String redactedUri()
      Returns:
      the URI with any password replaced, which is what belongs in a log or a report
    • settings

      public Map<String,Object> settings()
      Returns:
      everything the upstream defines: expires, message-ttl, ack-mode, max-hops, prefetch-count and the rest, exactly as the broker holds them
    • expires

      public Optional<Long> expires()
      Returns:
      how long the upstream's queue survives with nothing consuming from it, in milliseconds, or empty when it is unset — which means forever, and is how a decommissioned downstream leaves a queue growing on somebody else's broker
    • toString

      public String toString()
      Overrides:
      toString in class Object