|
33 | 33 |
|
34 | 34 | import com.rabbitmq.client.impl.AMQConnection; |
35 | 35 | import com.rabbitmq.client.impl.ConnectionParams; |
| 36 | +import com.rabbitmq.client.impl.DefaultExceptionHandler; |
| 37 | +import com.rabbitmq.client.impl.ExceptionHandler; |
36 | 38 | import com.rabbitmq.client.impl.FrameHandler; |
37 | 39 | import com.rabbitmq.client.impl.FrameHandlerFactory; |
38 | 40 | import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; |
@@ -90,6 +92,7 @@ public class ConnectionFactory implements Cloneable { |
90 | 92 | private SaslConfig saslConfig = DefaultSaslConfig.PLAIN; |
91 | 93 | private ExecutorService sharedExecutor; |
92 | 94 | private SocketConfigurator socketConf = new DefaultSocketConfigurator(); |
| 95 | + private ExceptionHandler exceptionHandler = new DefaultExceptionHandler(); |
93 | 96 |
|
94 | 97 | private boolean automaticRecovery = false; |
95 | 98 | private boolean topologyRecovery = true; |
@@ -426,6 +429,25 @@ public void setSharedExecutor(ExecutorService executor) { |
426 | 429 | this.sharedExecutor = executor; |
427 | 430 | } |
428 | 431 |
|
| 432 | + /** |
| 433 | + * Get the exception handler. |
| 434 | + * |
| 435 | + * @see com.rabbitmq.client.impl.ExceptionHandler |
| 436 | + */ |
| 437 | + public ExceptionHandler getExceptionHandler() { |
| 438 | + return exceptionHandler; |
| 439 | + } |
| 440 | + |
| 441 | + /** |
| 442 | + * Set the exception handler to use by default for newly created connections. |
| 443 | + * |
| 444 | + * @see com.rabbitmq.client.impl.ExceptionHandler |
| 445 | + */ |
| 446 | + |
| 447 | + public void setExceptionHandler(ExceptionHandler exceptionHandler) { |
| 448 | + this.exceptionHandler = exceptionHandler; |
| 449 | + } |
| 450 | + |
429 | 451 | public boolean isSSL(){ |
430 | 452 | return getSocketFactory() instanceof SSLSocketFactory; |
431 | 453 | } |
@@ -557,7 +579,7 @@ public Connection newConnection(ExecutorService executor, Address[] addrs) |
557 | 579 | public ConnectionParams params(ExecutorService executor) { |
558 | 580 | return new ConnectionParams(username, password, executor, virtualHost, getClientProperties(), |
559 | 581 | requestedFrameMax, requestedChannelMax, requestedHeartbeat, saslConfig, |
560 | | - networkRecoveryInterval, topologyRecovery); |
| 582 | + networkRecoveryInterval, topologyRecovery, exceptionHandler); |
561 | 583 | } |
562 | 584 |
|
563 | 585 | /** |
|
0 commit comments