Package com.rabbitmq.client

Examples of com.rabbitmq.client.ShutdownListener


  public ChannelHandler(ConnectionHandler connectionHandler, Channel delegate, Config config) {
    this.connectionHandler = connectionHandler;
    this.delegate = delegate;
    this.config = config;

    ShutdownListener listener = new ChannelShutdownListener();
    shutdownListeners.add(listener);
    delegate.addShutdownListener(listener);
  }
View Full Code Here


  public void createConnection(Connection proxy) throws IOException {
    try {
      this.proxy = proxy;
      createConnection(config.getConnectRetryPolicy(), config.getRetryableExceptions(), false);
      ShutdownListener shutdownListener = new ConnectionShutdownListener();
      shutdownListeners.add(shutdownListener);
      delegate.addShutdownListener(shutdownListener);
      for (ConnectionListener listener : config.getConnectionListeners())
        try {
          listener.onCreate(proxy);
View Full Code Here

    boolean autoDelete = config.isAutoDelete();

    final Connection connection = Connections.create(lyraOptions, lyraConfig);

    connection.addShutdownListener(
        new ShutdownListener()
        {
          @Override
          public void shutdownCompleted(ShutdownSignalException cause)
          {
            log.warn(cause, "Connection closed!");
          }
        }
    );

    final Channel channel = connection.createChannel();
    channel.queueDeclare(queue, durable, exclusive, autoDelete, null);
    channel.queueBind(queue, exchange, routingKey);
    channel.addShutdownListener(
        new ShutdownListener()
        {
          @Override
          public void shutdownCompleted(ShutdownSignalException cause)
          {
            log.warn(cause, "Channel closed!");
View Full Code Here

    // Recovery
    //

    private void addAutomaticRecoveryListener() {
        final AutorecoveringConnection c = this;
        ShutdownListener automaticRecoveryListener = new ShutdownListener() {
            public void shutdownCompleted(ShutdownSignalException cause) {
                try {
                    if (!cause.isInitiatedByApplication()) {
                        c.beginAutomaticRecovery();
                    }
View Full Code Here

            // Construct a channel directly
            final ChannelN ch = new ChannelN((AMQConnection) conn, n + 1,
                                             new ConsumerWorkService(Executors.newSingleThreadExecutor(),
                                                     Executors.defaultThreadFactory(), ConnectionFactory.DEFAULT_SHUTDOWN_TIMEOUT));
            conn.addShutdownListener(new ShutdownListener() {
                public void shutdownCompleted(ShutdownSignalException cause) {
                    // make sure channel.open continuation is released
                    ch.processShutdownSignal(cause, true, true);
                }
            });
View Full Code Here

        Log.warn (e);
        Threading.sleep (1000);
        continue;
      }
    }
    this._connection.addShutdownListener (new ShutdownListener () {
      @Override
      public void shutdownCompleted (final ShutdownSignalException cause)
      {
        Log.warn ("Connection to RabbitMQ failed!");
        while (true) {
View Full Code Here

    if (configuration.getVirtualHost() != null) {
      connectionFactory.setVirtualHost(configuration.getVirtualHost());
    }

    connection = connectionFactory.newConnection();
    connection.addShutdownListener(new ShutdownListener() {
      @Override
      public void shutdownCompleted(ShutdownSignalException cause) {
        log.warn("RabbitMQ connection lost", cause);

        status = MonitorStatusBuilder.failed("RabbitMQ connection lost", cause);
View Full Code Here

    public Channel createChannel() throws IOException
    {
        final Channel channel = newChannel();

        channel.addShutdownListener(new ShutdownListener()
        {
            @Override
            public void shutdownCompleted(final ShutdownSignalException cause)
            {
                if (!cause.isInitiatedByApplication())
View Full Code Here

    private synchronized void initializeConnection() throws IOException
    {
        if (connection == null)
        {
            connection = connectionFactory.newConnection();
            connection.addShutdownListener(new ShutdownListener()
            {
                @Override
                public void shutdownCompleted(final ShutdownSignalException cause)
                {
                    if (!cause.isInitiatedByApplication())
View Full Code Here

    final CountDownLatch latch = new CountDownLatch(1);
    try {
      template.execute(new ChannelCallback<Object>() {
        @Override
        public Object doInRabbit(Channel channel) throws Exception {
          channel.getConnection().addShutdownListener(new ShutdownListener() {
            @Override
            public void shutdownCompleted(ShutdownSignalException cause) {
              logger.info("Error", cause);
              latch.countDown();
              // This will be thrown on the Connection thread just before it dies, so basically ignored
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.ShutdownListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.