com.rabbitmq.client.ExceptionHandler Java Examples

The following examples show how to use com.rabbitmq.client.ExceptionHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectionBasedRabbitConnectionFactoryFactory.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public ConnectionFactory createConnectionFactory(final Connection connection,
        final ExceptionHandler exceptionHandler) {
    checkNotNull(connection, "Connection");
    checkNotNull(exceptionHandler, "Exception Handler");

    try {
        final ConnectionFactory connectionFactory = new CustomConnectionFactory();
        if (SECURE_AMQP_SCHEME.equalsIgnoreCase(connection.getProtocol())) {
            if (connection.isValidateCertificates()) {
                final SSLContextCreator sslContextCreator =
                        SSLContextCreator.fromConnection(connection, null);
                connectionFactory.useSslProtocol(sslContextCreator.withoutClientCertificate());
            } else {
                // attention: this accepts all certificates whether they are valid or not
                connectionFactory.useSslProtocol();
            }
        }

        connectionFactory.setUri(connection.getUri());

        // this makes no difference as the used newmotion client always sets the AutomaticRecoveryEnabled to false:
        connectionFactory.setAutomaticRecoveryEnabled(connection.isFailoverEnabled());

        connectionFactory.setExceptionHandler(exceptionHandler);

        configureConnectionFactory(connectionFactory, connection.getSpecificConfig());

        return connectionFactory;
    } catch (final NoSuchAlgorithmException | KeyManagementException | URISyntaxException e) {
        LOGGER.warn(e.getMessage());
        throw new IllegalStateException("Failed to create RabbitMQ connection factory.", e);
    }
}
 
Example #2
Source File: MockConnection.java    From rabbitmq-mock with Apache License 2.0 4 votes vote down vote up
@Override
public ExceptionHandler getExceptionHandler() {
    return exceptionHandler;
}
 
Example #3
Source File: TestConnection.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public ExceptionHandler getExceptionHandler() {
    throw new UnsupportedOperationException(
            "This method is not currently supported as it is not used by current API in testing");
}
 
Example #4
Source File: RabbitMQProducerAndConsumerConstructorInterceptorTest.java    From skywalking with Apache License 2.0 4 votes vote down vote up
@Override
public ExceptionHandler getExceptionHandler() {
    return null;
}
 
Example #5
Source File: RabbitMQConfiguration.java    From hammock with Apache License 2.0 4 votes vote down vote up
public ExceptionHandler getExceptionHandler() {
    return exceptionHandler;
}
 
Example #6
Source File: TestConnection.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public ExceptionHandler getExceptionHandler() {
    throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing");
}
 
Example #7
Source File: RabbitConnectionFactoryFactory.java    From ditto with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Creates a new {@code ConnectionFactory}.
 *
 * @param connection the connection to use for the returned Rabbit ConnectionFactory.
 * @param exceptionHandler the ExceptionHandler to configure for the returned Rabbit ConnectionFactory.
 * @return the Rabbit ConnectionFactory.
 * @throws NullPointerException when any argument is null
 */
ConnectionFactory createConnectionFactory(Connection connection, ExceptionHandler exceptionHandler);