Class ErrorBroker

java.lang.Object
org.apache.activemq.broker.ErrorBroker
All Implemented Interfaces:
Broker, Region, org.apache.activemq.Service

public class ErrorBroker extends Object implements Broker
Implementation of the broker where all it's methods throw an BrokerStoppedException.
  • Constructor Details

    • ErrorBroker

      public ErrorBroker(String message)
  • Method Details

    • getDestinationMap

      public Map<org.apache.activemq.command.ActiveMQDestination,Destination> getDestinationMap()
      Description copied from interface: Region
      Returns a reference to the concurrent hash map that holds known destinations, do not modify
      Specified by:
      getDestinationMap in interface Region
    • getDestinationMap

      public Map<org.apache.activemq.command.ActiveMQDestination,Destination> getDestinationMap(org.apache.activemq.command.ActiveMQDestination destination)
      Description copied from interface: Broker
      return a reference destination map of a region based on the destination type
      Specified by:
      getDestinationMap in interface Broker
      Parameters:
      destination - ActiveMQ Destination
      Returns:
      destination Map
    • getDestinations

      public Set<Destination> getDestinations(org.apache.activemq.command.ActiveMQDestination destination)
      Description copied from interface: Region
      Provide an exact or wildcard lookup of destinations in the region
      Specified by:
      getDestinations in interface Region
      Returns:
      a set of matching destination objects.
    • getAdaptor

      public Broker getAdaptor(Class<?> type)
      Description copied from interface: Broker
      Get a Broker from the Broker Stack that is a particular class
      Specified by:
      getAdaptor in interface Broker
      Parameters:
      type - a Broker type.
      Returns:
      a Broker instance.
    • getBrokerId

      public org.apache.activemq.command.BrokerId getBrokerId()
      Description copied from interface: Broker
      Get the id of the broker
      Specified by:
      getBrokerId in interface Broker
    • getBrokerName

      public String getBrokerName()
      Description copied from interface: Broker
      Get the name of the broker
      Specified by:
      getBrokerName in interface Broker
    • addConnection

      public void addConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info) throws Exception
      Description copied from interface: Broker
      A client is establishing a connection with the broker.
      Specified by:
      addConnection in interface Broker
      Throws:
      Exception - TODO
    • removeConnection

      public void removeConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info, Throwable error) throws Exception
      Description copied from interface: Broker
      A client is disconnecting from the broker.
      Specified by:
      removeConnection in interface Broker
      Parameters:
      context - the environment the operation is being executed under.
      info - metadata about the Broker
      error - null if the client requested the disconnect or the error that caused the client to disconnect.
      Throws:
      Exception - TODO
    • addSession

      public void addSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) throws Exception
      Description copied from interface: Broker
      Adds a session.
      Specified by:
      addSession in interface Broker
      Parameters:
      context - connection context
      info - metadata about the Broker
      Throws:
      Exception - TODO
    • removeSession

      public void removeSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) throws Exception
      Description copied from interface: Broker
      Removes a session.
      Specified by:
      removeSession in interface Broker
      Parameters:
      context - connection context
      info - metadata about the Broker
      Throws:
      Exception - TODO
    • addProducer

      public void addProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) throws Exception
      Description copied from interface: Broker
      Adds a producer.
      Specified by:
      addProducer in interface Broker
      Specified by:
      addProducer in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • removeProducer

      public void removeProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) throws Exception
      Description copied from interface: Broker
      Removes a producer.
      Specified by:
      removeProducer in interface Broker
      Specified by:
      removeProducer in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • getClients

      public Connection[] getClients() throws Exception
      Specified by:
      getClients in interface Broker
      Returns:
      all clients added to the Broker.
      Throws:
      Exception - TODO
    • getDestinations

      public org.apache.activemq.command.ActiveMQDestination[] getDestinations() throws Exception
      Specified by:
      getDestinations in interface Broker
      Returns:
      all destinations added to the Broker.
      Throws:
      Exception - TODO
    • getPreparedTransactions

      public org.apache.activemq.command.TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception
      Description copied from interface: Broker
      Gets a list of all the prepared xa transactions.
      Specified by:
      getPreparedTransactions in interface Broker
      Parameters:
      context - transaction ids
      Returns:
      array of TransactionId values
      Throws:
      Exception - TODO
    • beginTransaction

      public void beginTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception
      Description copied from interface: Broker
      Starts a transaction.
      Specified by:
      beginTransaction in interface Broker
      Parameters:
      context - connection context
      xid - transaction id
      Throws:
      Exception - TODO
    • prepareTransaction

      public int prepareTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception
      Description copied from interface: Broker
      Prepares a transaction. Only valid for xa transactions.
      Specified by:
      prepareTransaction in interface Broker
      Parameters:
      context - connection context
      xid - transaction id
      Returns:
      id
      Throws:
      Exception - TODO
    • rollbackTransaction

      public void rollbackTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception
      Description copied from interface: Broker
      Rollback a transaction.
      Specified by:
      rollbackTransaction in interface Broker
      Parameters:
      context - connection context
      xid - transaction id
      Throws:
      Exception - TODO
    • commitTransaction

      public void commitTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid, boolean onePhase) throws Exception
      Description copied from interface: Broker
      Commits a transaction.
      Specified by:
      commitTransaction in interface Broker
      Parameters:
      context - connection context
      xid - transaction id
      onePhase - is COMMIT_ONE_PHASE
      Throws:
      Exception - TODO
    • forgetTransaction

      public void forgetTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId transactionId) throws Exception
      Description copied from interface: Broker
      Forgets a transaction.
      Specified by:
      forgetTransaction in interface Broker
      Parameters:
      context - connection context
      transactionId - transaction id
      Throws:
      Exception - TODO
    • addDestination

      public Destination addDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean flag) throws Exception
      Description copied from interface: Region
      Used to create a destination. Usually, this method is invoked as a side-effect of sending a message to a destination that does not exist yet.
      Specified by:
      addDestination in interface Region
      destination - the destination to create.
      Returns:
      TODO
      Throws:
      Exception - TODO
    • removeDestination

      public void removeDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, long timeout) throws Exception
      Description copied from interface: Region
      Used to destroy a destination. This should try to quiesce use of the destination up to the timeout allotted time before removing the destination. This will remove all persistent messages associated with the destination.
      Specified by:
      removeDestination in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      destination - what is being removed from the broker.
      timeout - the max amount of time to wait for the destination to quiesce
      Throws:
      Exception - TODO
    • addConsumer

      public Subscription addConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception
      Description copied from interface: Region
      Adds a consumer.
      Specified by:
      addConsumer in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      Returns:
      TODO
      Throws:
      Exception - TODO
    • removeConsumer

      public void removeConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception
      Description copied from interface: Region
      Removes a consumer.
      Specified by:
      removeConsumer in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • removeSubscription

      public void removeSubscription(ConnectionContext context, org.apache.activemq.command.RemoveSubscriptionInfo info) throws Exception
      Description copied from interface: Region
      Deletes a durable subscription.
      Specified by:
      removeSubscription in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      info - TODO
      Throws:
      Exception - TODO
    • send

      public void send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message message) throws Exception
      Description copied from interface: Region
      Send a message to the broker to using the specified destination. The destination specified in the message does not need to match the destination the message is sent to. This is handy in case the message is being sent to a dead letter destination.
      Specified by:
      send in interface Region
      Parameters:
      producerExchange - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • acknowledge

      public void acknowledge(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.MessageAck ack) throws Exception
      Description copied from interface: Region
      Used to acknowledge the receipt of a message by a client.
      Specified by:
      acknowledge in interface Region
      Parameters:
      consumerExchange - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • gc

      public void gc()
      Specified by:
      gc in interface Region
    • start

      public void start() throws Exception
      Specified by:
      start in interface org.apache.activemq.Service
      Throws:
      Exception
    • stop

      public void stop() throws Exception
      Specified by:
      stop in interface org.apache.activemq.Service
      Throws:
      Exception
    • addBroker

      public void addBroker(Connection connection, org.apache.activemq.command.BrokerInfo info)
      Description copied from interface: Broker
      A remote Broker connects
      Specified by:
      addBroker in interface Broker
    • removeBroker

      public void removeBroker(Connection connection, org.apache.activemq.command.BrokerInfo info)
      Description copied from interface: Broker
      Remove a BrokerInfo
      Specified by:
      removeBroker in interface Broker
      Parameters:
      connection - Broker connection
      info - metadata about the Broker
    • getPeerBrokerInfos

      public org.apache.activemq.command.BrokerInfo[] getPeerBrokerInfos()
      Description copied from interface: Broker
      Get the BrokerInfo's of any connected Brokers
      Specified by:
      getPeerBrokerInfos in interface Broker
      Returns:
      array of peer BrokerInfos
    • preProcessDispatch

      public void preProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch)
      Description copied from interface: Broker
      Notify the Broker that a dispatch is going to happen
      Specified by:
      preProcessDispatch in interface Broker
      Parameters:
      messageDispatch - MessageDispatch object being dispatched
    • postProcessDispatch

      public void postProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch)
      Description copied from interface: Broker
      Notify the Broker that a dispatch has happened
      Specified by:
      postProcessDispatch in interface Broker
      Parameters:
      messageDispatch - MessageDispatch that has dispatched
    • processDispatchNotification

      public void processDispatchNotification(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) throws Exception
      Description copied from interface: Region
      Process a notification of a dispatch - used by a Slave Broker
      Specified by:
      processDispatchNotification in interface Region
      Throws:
      Exception - TODO
    • isStopped

      public boolean isStopped()
      Specified by:
      isStopped in interface Broker
      Returns:
      true if the broker has stopped
    • getDurableDestinations

      public Set<org.apache.activemq.command.ActiveMQDestination> getDurableDestinations()
      Specified by:
      getDurableDestinations in interface Broker
      Returns:
      a Set of all durable destinations
    • addDestinationInfo

      public void addDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) throws Exception
      Description copied from interface: Broker
      Add and process a DestinationInfo object
      Specified by:
      addDestinationInfo in interface Broker
      Parameters:
      context - connection context
      info - destination info
      Throws:
      Exception - TODO
    • removeDestinationInfo

      public void removeDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) throws Exception
      Description copied from interface: Broker
      Remove and process a DestinationInfo object
      Specified by:
      removeDestinationInfo in interface Broker
      Parameters:
      context - connection context
      info - destination info
      Throws:
      Exception - TODO
    • isFaultTolerantConfiguration

      public boolean isFaultTolerantConfiguration()
      Specified by:
      isFaultTolerantConfiguration in interface Broker
      Returns:
      true if fault-tolerant
    • getAdminConnectionContext

      public ConnectionContext getAdminConnectionContext()
      Specified by:
      getAdminConnectionContext in interface Broker
      Returns:
      the connection context used to make administration operations on startup or via JMX MBeans
    • setAdminConnectionContext

      public void setAdminConnectionContext(ConnectionContext adminConnectionContext)
      Description copied from interface: Broker
      Sets the default administration connection context used when configuring the broker on startup or via JMX
      Specified by:
      setAdminConnectionContext in interface Broker
      Parameters:
      adminConnectionContext - default administration connection context
    • messagePull

      public org.apache.activemq.command.Response messagePull(ConnectionContext context, org.apache.activemq.command.MessagePull pull)
      Description copied from interface: Region
      Allows a consumer to pull a message from a queue
      Specified by:
      messagePull in interface Region
    • getTempDataStore

      public PListStore getTempDataStore()
      Specified by:
      getTempDataStore in interface Broker
      Returns:
      the temp data store
    • getVmConnectorURI

      public URI getVmConnectorURI()
      Specified by:
      getVmConnectorURI in interface Broker
      Returns:
      the URI that can be used to connect to the local Broker
    • brokerServiceStarted

      public void brokerServiceStarted()
      Description copied from interface: Broker
      called when the brokerService starts
      Specified by:
      brokerServiceStarted in interface Broker
    • getBrokerService

      public BrokerService getBrokerService()
      Specified by:
      getBrokerService in interface Broker
      Returns:
      the BrokerService
    • isExpired

      public boolean isExpired(org.apache.activemq.broker.region.MessageReference messageReference)
      Description copied from interface: Broker
      Determine if a message has expired -allows default behaviour to be overridden - as the timestamp set by the producer can be out of sync with the broker
      Specified by:
      isExpired in interface Broker
      Parameters:
      messageReference - message reference
      Returns:
      true if the message is expired
    • messageExpired

      public void messageExpired(ConnectionContext context, org.apache.activemq.broker.region.MessageReference message, Subscription subscription)
      Description copied from interface: Broker
      A Message has Expired
      Specified by:
      messageExpired in interface Broker
      Parameters:
      context - connection context
      message - message reference
      subscription - (maybe null)
    • sendToDeadLetterQueue

      public boolean sendToDeadLetterQueue(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference, Subscription subscription, Throwable poisonCause)
      Description copied from interface: Broker
      A message needs to go to the DLQ
      Specified by:
      sendToDeadLetterQueue in interface Broker
      Parameters:
      context - connection context
      messageReference - message reference
      poisonCause - reason for dlq submission, may be null
      Returns:
      true if Message was placed in a DLQ false if discarded.
    • getRoot

      public Broker getRoot()
      Description copied from interface: Broker
      Ensure we get the Broker at the top of the Stack
      Specified by:
      getRoot in interface Broker
      Returns:
      the broker at the top of the Stack
    • getBrokerSequenceId

      public long getBrokerSequenceId()
      Specified by:
      getBrokerSequenceId in interface Broker
      Returns:
      the broker sequence id
    • fastProducer

      public void fastProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo producerInfo, org.apache.activemq.command.ActiveMQDestination destination)
      Description copied from interface: Broker
      Called to notify a producer is too fast
      Specified by:
      fastProducer in interface Broker
      Parameters:
      context - connection context
      producerInfo - producer info
      destination - destination
    • isFull

      public void isFull(ConnectionContext context, Destination destination, org.apache.activemq.usage.Usage<?> usage)
      Description copied from interface: Broker
      Called when a Usage reaches a limit
      Specified by:
      isFull in interface Broker
      Parameters:
      context - create new scratch file from selection
      destination - destination
      usage - usage
    • messageConsumed

      public void messageConsumed(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference)
      Description copied from interface: Broker
      called when message is consumed
      Specified by:
      messageConsumed in interface Broker
      Parameters:
      context - connection context
      messageReference - message reference
    • messageDelivered

      public void messageDelivered(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference)
      Description copied from interface: Broker
      Called when message is delivered to the broker
      Specified by:
      messageDelivered in interface Broker
      Parameters:
      context - connection context
      messageReference - message reference
    • messageDispatched

      public void messageDispatched(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference)
      Description copied from interface: Broker
      Called when message is dispatched to a consumer
      Specified by:
      messageDispatched in interface Broker
      Parameters:
      context - connection context
      sub - subscription
      messageReference - message reference
    • messageDiscarded

      public void messageDiscarded(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference)
      Description copied from interface: Broker
      Called when a message is discarded - e.g. running low on memory This will happen only if the policy is enabled - e.g. non-durable topics
      Specified by:
      messageDiscarded in interface Broker
      Parameters:
      context - connection context
      sub - subscription
      messageReference - message reference
    • slowConsumer

      public void slowConsumer(ConnectionContext context, Destination destination, Subscription subs)
      Description copied from interface: Broker
      Called when there is a slow consumer
      Specified by:
      slowConsumer in interface Broker
      Parameters:
      context - connection context
      destination - destination
      subs - subscription
    • virtualDestinationAdded

      public void virtualDestinationAdded(ConnectionContext context, VirtualDestination virtualDestination)
      Specified by:
      virtualDestinationAdded in interface Broker
    • virtualDestinationRemoved

      public void virtualDestinationRemoved(ConnectionContext context, VirtualDestination virtualDestination)
      Specified by:
      virtualDestinationRemoved in interface Broker
    • nowMasterBroker

      public void nowMasterBroker()
      Description copied from interface: Broker
      called when the broker becomes the master in a master/slave configuration
      Specified by:
      nowMasterBroker in interface Broker
    • processConsumerControl

      public void processConsumerControl(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.ConsumerControl control)
      Specified by:
      processConsumerControl in interface Region
    • reapplyInterceptor

      public void reapplyInterceptor()
      Specified by:
      reapplyInterceptor in interface Region
    • getScheduler

      public org.apache.activemq.thread.Scheduler getScheduler()
      Description copied from interface: Broker
      called to get scheduler for executing TimerTask
      Specified by:
      getScheduler in interface Broker
    • getExecutor

      public ThreadPoolExecutor getExecutor()
      Description copied from interface: Broker
      called to get Java thread pool executor
      Specified by:
      getExecutor in interface Broker
    • networkBridgeStarted

      public void networkBridgeStarted(org.apache.activemq.command.BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp)
      Description copied from interface: Broker
      called to when a network bridge is started
      Specified by:
      networkBridgeStarted in interface Broker
      Parameters:
      brokerInfo - metadata about the broker
      createdByDuplex - is created by duplex
      remoteIp - ip address of the broker
    • networkBridgeStopped

      public void networkBridgeStopped(org.apache.activemq.command.BrokerInfo brokerInfo)
      Description copied from interface: Broker
      called to when a network bridge is stopped
      Specified by:
      networkBridgeStopped in interface Broker
      Parameters:
      brokerInfo - metadata about the broker