public class JMSConnectionFactoryHandler extends Object implements IJMSConnectionFactoryProvider
| Modifier and Type | Field and Description |
|---|---|
private javax.jms.ConnectionFactory |
connectionFactory |
private PropertyContext |
context |
private ComponentLog |
logger |
private Set<PropertyDescriptor> |
propertyDescriptors |
| Constructor and Description |
|---|
JMSConnectionFactoryHandler(ConfigurationContext context,
ComponentLog logger) |
JMSConnectionFactoryHandler(ProcessContext context,
ComponentLog logger) |
| Modifier and Type | Method and Description |
|---|---|
private void |
createConnectionFactoryInstance()
Creates an instance of the
ConnectionFactory from the provided
'CONNECTION_FACTORY_IMPL'. |
javax.jms.ConnectionFactory |
getConnectionFactory() |
private void |
initConnectionFactory() |
void |
resetConnectionFactory(javax.jms.ConnectionFactory cachedFactory) |
(package private) void |
setConnectionFactoryProperties()
This operation follows standard bean convention by matching property name
to its corresponding 'setter' method.
|
(package private) void |
setProperty(String propertyName,
Object propertyValue)
Sets corresponding
ConnectionFactory's property to a
'propertyValue' by invoking a 'setter' method that corresponds to
'propertyName'. |
private String |
toMethodName(String propertyName)
Will convert propertyName to a method name following bean convention.
|
private final PropertyContext context
private final Set<PropertyDescriptor> propertyDescriptors
private final ComponentLog logger
private volatile javax.jms.ConnectionFactory connectionFactory
public JMSConnectionFactoryHandler(ConfigurationContext context, ComponentLog logger)
public JMSConnectionFactoryHandler(ProcessContext context, ComponentLog logger)
public javax.jms.ConnectionFactory getConnectionFactory()
getConnectionFactory in interface IJMSConnectionFactoryProviderpublic void resetConnectionFactory(javax.jms.ConnectionFactory cachedFactory)
resetConnectionFactory in interface IJMSConnectionFactoryProviderprivate void initConnectionFactory()
private void createConnectionFactoryInstance()
ConnectionFactory from the provided
'CONNECTION_FACTORY_IMPL'.void setConnectionFactoryProperties()
There are also few adjustments to accommodate well known brokers. For example ActiveMQ ConnectionFactory accepts address of the Message Broker in a form of URL while IBMs in the form of host/port pair(s).
This method will use the value retrieved from the 'BROKER_URI' static property as is. An exception to this if ConnectionFactory implementation is coming from IBM MQ and connecting to a stand-alone queue manager. In this case the Broker URI is expected to be entered as a colon separated host/port pair, which then is split on ':' and the resulting pair will be used to execute setHostName(..) and setPort(..) methods on the provided ConnectionFactory.
This method may need to be maintained and adjusted to accommodate other implementation of ConnectionFactory, but only for URL/Host/Port issue. All other properties are set as dynamic properties where user essentially provides both property name and value.
void setProperty(String propertyName, Object propertyValue)
ConnectionFactory's property to a
'propertyValue' by invoking a 'setter' method that corresponds to
'propertyName'. For example, 'channel' property will correspond to
'setChannel(..) method and 'queueManager' property will correspond to
setQueueManager(..) method with a single argument.
NOTE: There is a limited type conversion to accommodate property value
types since all NiFi configuration properties comes as String. It is
accomplished by checking the argument type of the method and executing
its corresponding conversion to target primitive (e.g., value 'true' will
go thru Boolean.parseBoolean(propertyValue) if method argument is of type
boolean). None-primitive values are not supported at the moment and will
result in IllegalArgumentException. It is OK though since based
on analysis of several ConnectionFactory implementation the all seem to
follow bean convention and all their properties using Java primitives as
arguments.
Copyright © 2021 Apache NiFi Project. All rights reserved.