Class JMSConnectionFactoryHandler
- All Implemented Interfaces:
IJMSConnectionFactoryProvider,JMSConnectionFactoryHandlerDefinition
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PropertyContextprivate final ComponentLogprivate final Set<PropertyDescriptor> -
Constructor Summary
ConstructorsConstructorDescriptionJMSConnectionFactoryHandler(ConfigurationContext context, ComponentLog logger) JMSConnectionFactoryHandler(ProcessContext context, ComponentLog logger) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.jms.ConnectionFactoryprivate jakarta.jms.ConnectionFactoryCreates an instance of theConnectionFactoryfrom the provided 'CONNECTION_FACTORY_IMPL'.(package private) voidsetConnectionFactoryProperties(jakarta.jms.ConnectionFactory connectionFactory) This operation follows standard bean convention by matching property name to its corresponding 'setter' method.(package private) voidsetProperty(jakarta.jms.ConnectionFactory connectionFactory, String propertyName, Object propertyValue) Sets correspondingConnectionFactory's property to a 'propertyValue' by invoking a 'setter' method that corresponds to 'propertyName'.private StringtoMethodName(String propertyName) Will convert propertyName to a method name following bean convention.Methods inherited from class org.apache.nifi.jms.cf.CachedJMSConnectionFactoryHandler
getConnectionFactory, resetConnectionFactory
-
Field Details
-
context
-
propertyDescriptors
-
logger
-
-
Constructor Details
-
JMSConnectionFactoryHandler
-
JMSConnectionFactoryHandler
-
-
Method Details
-
createConnectionFactory
public jakarta.jms.ConnectionFactory createConnectionFactory()- Specified by:
createConnectionFactoryin classCachedJMSConnectionFactoryHandler
-
createConnectionFactoryInstance
private jakarta.jms.ConnectionFactory createConnectionFactoryInstance()Creates an instance of theConnectionFactoryfrom the provided 'CONNECTION_FACTORY_IMPL'. -
setConnectionFactoryProperties
void setConnectionFactoryProperties(jakarta.jms.ConnectionFactory connectionFactory) This operation follows standard bean convention by matching property name to its corresponding 'setter' method. Once the method was located it is invoked to set the corresponding property to a value provided by during service configuration. For example, 'channel' property will correspond to 'setChannel(..) method and 'queueManager' property will correspond to setQueueManager(..) method with a single argument. The bean convention is also explained in user manual for this component with links pointing to documentation of various ConnectionFactories.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.
- See Also:
-
setProperty
void setProperty(jakarta.jms.ConnectionFactory connectionFactory, String propertyName, Object propertyValue) Sets correspondingConnectionFactory'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. -
toMethodName
Will convert propertyName to a method name following bean convention. For example, 'channel' property will correspond to 'setChannel method and 'queueManager' property will correspond to setQueueManager method name
-