List of usage examples for org.springframework.integration.stomp.event StompConnectionFailedEvent StompConnectionFailedEvent
public StompConnectionFailedEvent(Object source, Throwable cause)
From source file:org.springframework.integration.stomp.AbstractStompSessionManager.java
private void scheduleReconnect(Throwable e) { this.epoch.incrementAndGet(); this.connecting = this.connected = false; if (e != null) { this.logger.error("STOMP connect error for " + this, e); }/*from w w w .j a v a 2s . c o m*/ if (this.applicationEventPublisher != null) { this.applicationEventPublisher.publishEvent(new StompConnectionFailedEvent(this, e)); } // cancel() after the publish in case we are on that thread; a send to a QueueChannel would fail. if (this.reconnectFuture != null) { this.reconnectFuture.cancel(true); this.reconnectFuture = null; } if (this.stompClient.getTaskScheduler() != null) { this.reconnectFuture = this.stompClient.getTaskScheduler().schedule((Runnable) () -> connect(), new Date(System.currentTimeMillis() + this.recoveryInterval)); } else { this.logger.info( "For automatic reconnection the 'stompClient' should be configured with a TaskScheduler."); } }