Untitled
unknown
plain_text
a year ago
1.8 kB
1
Indexable
Never
@Override public void run() { Channel channel = null; try { channel = RabbitMQManager.getChannelPool().getChannel(); channel.addShutdownListener(cause -> { /* Obsłuż sobie SMS - POLACZENIE BYLO ALE PADLO */ System.out.println("RECONNECT"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } run(); }); /* Utworzenie kolejki */ channel.queueDeclare(queueName, false, false, true, null); channel.exchangeDeclare(exchangeName, BuiltinExchangeType.FANOUT); channel.queueBind(queueName,exchangeName,""); channel.basicConsume(queueName, autoAck, new RabbitMQConsumer(channel, autoAck)); logger.info("RabbitMQManager :: " + queueName + " :: start listening..."); } catch (Exception e) { logger.error("QueueListener exception: ", e); /* Obsłuż sobie SMS -> PODCZAS NAWIAZYWANIA POLACZENIA NIE UDALO SIE */ try { RabbitMQManager.getChannelPool().invalidateObject(channel); } catch (Exception exception) { //TODO: add logger //ThreadPoolManager.getLogger().error("MessageSender connection invalidateObject: ", closeException); } try { Thread.sleep(1000); } catch (InterruptedException interruptedException) { interruptedException.printStackTrace(); } run(); } }