Search in sources :

Example 1 with MQQueueConnectionFactory

use of com.ibm.mq.jms.MQQueueConnectionFactory in project pentaho-kettle by pentaho.

the class WebsphereMQProvider method getContext.

@Override
public JMSContext getContext(JmsDelegate meta, VariableSpace variableSpace) {
    MQUrlResolver resolver = new MQUrlResolver(meta, variableSpace);
    MQConnectionFactory connFactory = isQueue(meta, variableSpace) ? new MQQueueConnectionFactory() : new MQTopicConnectionFactory();
    connFactory.setHostName(resolver.host);
    try {
        connFactory.setPort(resolver.port);
        connFactory.setQueueManager(resolver.queueManager);
        connFactory.setChannel(resolver.channel);
        connFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
    } catch (JMSException e) {
        throw new RuntimeException(e);
    }
    return connFactory.createContext(variableSpace.environmentSubstitute(meta.ibmUsername), variableSpace.environmentSubstitute(meta.ibmPassword));
}
Also used : MQTopicConnectionFactory(com.ibm.mq.jms.MQTopicConnectionFactory) MQQueueConnectionFactory(com.ibm.mq.jms.MQQueueConnectionFactory) JMSException(javax.jms.JMSException) MQConnectionFactory(com.ibm.mq.jms.MQConnectionFactory)

Example 2 with MQQueueConnectionFactory

use of com.ibm.mq.jms.MQQueueConnectionFactory in project pentaho-kettle by pentaho.

the class WebsphereMQProvider method getContext.

@Override
public JMSContext getContext(JmsDelegate meta) {
    MQUrlResolver resolver = new MQUrlResolver(meta);
    MQConnectionFactory connFactory = isQueue(meta) ? new MQQueueConnectionFactory() : new MQTopicConnectionFactory();
    connFactory.setHostName(resolver.host);
    if (meta.sslEnabled) {
        // try to configure SSL settings
        try {
            SSLContext sslContext = meta.sslUseDefaultContext ? SSLContext.getDefault() : getSslContext(meta);
            SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
            connFactory.setSSLFipsRequired(meta.ibmSslFipsRequired.toLowerCase().startsWith("t") || meta.ibmSslFipsRequired.toLowerCase().startsWith("y"));
            connFactory.setSSLSocketFactory(sslSocketFactory);
            connFactory.setSSLCipherSuite(meta.sslCipherSuite);
        } catch (GeneralSecurityException | IOException e) {
            throw new IllegalStateException(e);
        }
    }
    try {
        connFactory.setPort(resolver.port);
        connFactory.setQueueManager(resolver.queueManager);
        connFactory.setChannel(resolver.channel);
        connFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
    } catch (JMSException e) {
        throw new IllegalStateException(e);
    }
    return connFactory.createContext(meta.ibmUsername, meta.ibmPassword);
}
Also used : MQTopicConnectionFactory(com.ibm.mq.jms.MQTopicConnectionFactory) GeneralSecurityException(java.security.GeneralSecurityException) MQQueueConnectionFactory(com.ibm.mq.jms.MQQueueConnectionFactory) JMSException(javax.jms.JMSException) SSLContext(javax.net.ssl.SSLContext) IOException(java.io.IOException) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) MQConnectionFactory(com.ibm.mq.jms.MQConnectionFactory)

Aggregations

MQConnectionFactory (com.ibm.mq.jms.MQConnectionFactory)2 MQQueueConnectionFactory (com.ibm.mq.jms.MQQueueConnectionFactory)2 MQTopicConnectionFactory (com.ibm.mq.jms.MQTopicConnectionFactory)2 JMSException (javax.jms.JMSException)2 IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1 SSLContext (javax.net.ssl.SSLContext)1 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)1