Package org.apache.activemq
Class ActiveMQSslConnectionFactory
java.lang.Object
org.apache.activemq.jndi.JNDIBaseStorable
org.apache.activemq.ActiveMQConnectionFactory
org.apache.activemq.ActiveMQSslConnectionFactory
- All Implemented Interfaces:
jakarta.jms.ConnectionFactory
,jakarta.jms.QueueConnectionFactory
,jakarta.jms.TopicConnectionFactory
,Externalizable
,Serializable
,Cloneable
,Referenceable
,JNDIStorableInterface
,StatsCapable
- Direct Known Subclasses:
ActiveMQXASslConnectionFactory
An ActiveMQConnectionFactory that allows access to the key and trust managers
used for SslConnections. There is no reason to use this class unless SSL is
being used AND the key and trust managers need to be specified from within
code. In fact, if the URI passed to this class does not have an "ssl" scheme,
this class will pass all work on to its superclass.
There are two alternative approaches you can use to provide X.509
certificates for the SSL connections:
Call
setTrustStore
, setTrustStorePassword
,
setKeyStore
, and setKeyStorePassword
.
Call setKeyAndTrustManagers
.- Author:
- [email protected]
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected KeyManager[]
protected String
protected String
protected String
protected String
protected SecureRandom
protected TrustManager[]
protected String
protected String
protected String
Fields inherited from class org.apache.activemq.ActiveMQConnectionFactory
alwaysSessionAsync, brokerURL, clientID, DEFAULT_BROKER_BIND_URL, DEFAULT_BROKER_URL, DEFAULT_PASSWORD, DEFAULT_PRODUCER_WINDOW_SIZE, DEFAULT_USER, dispatchAsync, password, userName, xaAckMode
-
Constructor Summary
ConstructorDescriptionActiveMQSslConnectionFactory
(String brokerURL) ActiveMQSslConnectionFactory
(URI brokerURL) -
Method Summary
Modifier and TypeMethodDescriptionprotected KeyManager[]
protected Transport
Overriding to make special considerations for SSL connections.protected TrustManager[]
protected InputStream
getInputStream
(String urlOrResource) protected byte[]
loadClientCredential
(String fileName) void
setKeyAndTrustManagers
(KeyManager[] km, TrustManager[] tm, SecureRandom random) Sets the key and trust managers used when creating SSL connections.void
setKeyStore
(String keyStore) The location of a keystore file (injks
format) containing a certificate and its private key.void
setKeyStoreKeyPassword
(String keyStoreKeyPassword) The password to match the key from the keyStore.void
setKeyStorePassword
(String keyStorePassword) The password to match the key store specified bysetKeyStore(java.lang.String)
.void
setKeyStoreType
(String type) void
setTrustStore
(String trustStore) The location of a keystore file (injks
format) containing one or more trusted certificates.void
setTrustStorePassword
(String trustStorePassword) The password to match the trust store specified bysetTrustStore(java.lang.String)
.void
setTrustStoreType
(String type) Methods inherited from class org.apache.activemq.ActiveMQConnectionFactory
buildFromMap, buildFromProperties, configureConnection, copy, createActiveMQConnection, createActiveMQConnection, createActiveMQConnection, createConnection, createConnection, createContext, createContext, createContext, createContext, createQueueConnection, createQueueConnection, createTopicConnection, createTopicConnection, getAuditDepth, getAuditMaximumProducerNumber, getBlobTransferPolicy, getBrokerURL, getClientID, getClientIdGenerator, getClientIDPrefix, getClientInternalExceptionListener, getCloseTimeout, getConnectionIdGenerator, getConnectResponseTimeout, getConsumerFailoverRedeliveryWaitPeriod, getExceptionListener, getMaxThreadPoolSize, getOptimizeAcknowledgeTimeOut, getOptimizedAckScheduledAckInterval, getPassword, getPrefetchPolicy, getProducerWindowSize, getRedeliveryPolicy, getRedeliveryPolicyMap, getRejectedTaskHandler, getSendTimeout, getSessionTaskRunner, getStats, getTransformer, getTransportListener, getTrustedPackages, getUserName, getWarnAboutUnstartedConnectionTimeout, isAlwaysSessionAsync, isAlwaysSyncSend, isCheckForDuplicates, isConsumerExpiryCheckEnabled, isCopyMessageOnSend, isDisableTimeStampsByDefault, isDispatchAsync, isExclusiveConsumer, isMessagePrioritySupported, isNestedMapAndListEnabled, isNonBlockingRedelivery, isObjectMessageSerializationDefered, isOptimizeAcknowledge, isOptimizedMessageDispatch, isRmIdFromConnectionId, isSendAcksAsync, isStatsEnabled, isTransactedIndividualAck, isTrustAllPackages, isUseAsyncSend, isUseCompression, isUseDedicatedTaskRunner, isUseRetroactiveConsumer, isWatchTopicAdvisories, populateProperties, setAlwaysSessionAsync, setAlwaysSyncSend, setAuditDepth, setAuditMaximumProducerNumber, setBlobTransferPolicy, setBrokerURL, setCheckForDuplicates, setClientID, setClientIdGenerator, setClientIDPrefix, setClientInternalExceptionListener, setCloseTimeout, setConnectionIdGenerator, setConnectionIDPrefix, setConnectResponseTimeout, setConsumerExpiryCheckEnabled, setConsumerFailoverRedeliveryWaitPeriod, setCopyMessageOnSend, setDisableTimeStampsByDefault, setDispatchAsync, setExceptionListener, setExclusiveConsumer, setMaxThreadPoolSize, setMessagePrioritySupported, setNestedMapAndListEnabled, setNonBlockingRedelivery, setObjectMessageSerializationDefered, setOptimizeAcknowledge, setOptimizeAcknowledgeTimeOut, setOptimizedAckScheduledAckInterval, setOptimizedMessageDispatch, setPassword, setPrefetchPolicy, setProducerWindowSize, setRedeliveryPolicy, setRedeliveryPolicyMap, setRejectedTaskHandler, setRmIdFromConnectionId, setSendAcksAsync, setSendTimeout, setSessionTaskRunner, setStatsEnabled, setTransactedIndividualAck, setTransformer, setTransportListener, setTrustAllPackages, setTrustedPackages, setUseAsyncSend, setUseCompression, setUseDedicatedTaskRunner, setUseRetroactiveConsumer, setUserName, setWarnAboutUnstartedConnectionTimeout, setWatchTopicAdvisories
Methods inherited from class org.apache.activemq.jndi.JNDIBaseStorable
getProperties, getReference, readExternal, setProperties, writeExternal
-
Field Details
-
keyManager
-
trustManager
-
secureRandom
-
trustStoreType
-
trustStore
-
trustStorePassword
-
keyStoreType
-
keyStore
-
keyStorePassword
-
keyStoreKeyPassword
-
-
Constructor Details
-
ActiveMQSslConnectionFactory
public ActiveMQSslConnectionFactory() -
ActiveMQSslConnectionFactory
-
ActiveMQSslConnectionFactory
-
-
Method Details
-
setKeyAndTrustManagers
Sets the key and trust managers used when creating SSL connections.- Parameters:
km
- The KeyManagers used.tm
- The TrustManagers used.random
- The SecureRandom number used.
-
createTransport
Overriding to make special considerations for SSL connections. If we are not using SSL, the superclass's method is called. If we are using SSL, an SslConnectionFactory is used and it is given the needed key and trust managers.- Overrides:
createTransport
in classActiveMQConnectionFactory
- Returns:
- The newly created Transport.
- Throws:
jakarta.jms.JMSException
- If unable to create trasnport.
-
createTrustManager
- Throws:
Exception
-
createKeyManager
- Throws:
Exception
-
loadClientCredential
- Throws:
IOException
-
getInputStream
- Throws:
IOException
-
getTrustStoreType
-
setTrustStoreType
-
getTrustStore
-
setTrustStore
The location of a keystore file (injks
format) containing one or more trusted certificates.- Parameters:
trustStore
- If specified with a scheme, treat as a URL, otherwise treat as a classpath resource.- Throws:
Exception
-
getTrustStorePassword
-
setTrustStorePassword
The password to match the trust store specified bysetTrustStore(java.lang.String)
.- Parameters:
trustStorePassword
- The password used to unlock the keystore file.
-
getKeyStoreType
-
setKeyStoreType
-
getKeyStore
-
setKeyStore
The location of a keystore file (injks
format) containing a certificate and its private key.- Parameters:
keyStore
- If specified with a scheme, treat as a URL, otherwise treat as a classpath resource.- Throws:
Exception
-
getKeyStorePassword
-
setKeyStorePassword
The password to match the key store specified bysetKeyStore(java.lang.String)
.- Parameters:
keyStorePassword
- The password, which is used both to unlock the keystore file and as the pass phrase for the private key stored in the keystore.
-
getKeyStoreKeyPassword
-
setKeyStoreKeyPassword
The password to match the key from the keyStore.- Parameters:
keyStoreKeyPassword
- The password for the private key stored in the keyStore if different from keyStorePassword.
-