@Tags(value={"jms","get","message","receive","consume"}) @InputRequirement(value=INPUT_FORBIDDEN) @CapabilityDescription(value="Consumes JMS Message of type BytesMessage, TextMessage, ObjectMessage, MapMessage or StreamMessage transforming its content to a FlowFile and transitioning it to \'success\' relationship. JMS attributes such as headers and properties will be copied as FlowFile attributes. MapMessages will be transformed into JSONs and then into byte arrays. The other types will have their raw contents as byte array transferred into the flowfile.") @WritesAttribute(attribute="jms_deliveryMode",description="The JMSDeliveryMode from the message header.") @WritesAttribute(attribute="jms_expiration",description="The JMSExpiration from the message header.") @WritesAttribute(attribute="jms_priority",description="The JMSPriority from the message header.") @WritesAttribute(attribute="jms_redelivered",description="The JMSRedelivered from the message header.") @WritesAttribute(attribute="jms_timestamp",description="The JMSTimestamp from the message header.") @WritesAttribute(attribute="jms_correlationId",description="The JMSCorrelationID from the message header.") @WritesAttribute(attribute="jms_messageId",description="The JMSMessageID from the message header.") @WritesAttribute(attribute="jms_type",description="The JMSType from the message header.") @WritesAttribute(attribute="jms_replyTo",description="The JMSReplyTo from the message header.") @WritesAttribute(attribute="jms_destination",description="The JMSDestination from the message header.") @WritesAttribute(attribute="jms.messagetype",description="The JMS message type, can be TextMessage, BytesMessage, ObjectMessage, MapMessage or StreamMessage).") @WritesAttribute(attribute="other attributes",description="Each message property is written to an attribute.") @DynamicProperty(name="The name of a Connection Factory configuration property.", value="The value of a given Connection Factory configuration property.", description="Additional configuration property for the Connection Factory. It can be used when the Connection Factory is being configured via the \'JNDI *\' or the \'JMS *\'properties of the processor. For more information, see the Additional Details page.", expressionLanguageScope=VARIABLE_REGISTRY) @SeeAlso(value={PublishJMS.class,JMSConnectionFactoryProvider.class}) public class ConsumeJMS extends AbstractJMSProcessor<JMSConsumer>
AbstractJMSProcessor.onTrigger(ProcessContext, ProcessSession) method will construct a
FlowFile containing the body of the consumed JMS message and JMS
properties that came with message which are added to a FlowFile as
attributes.AbstractJMSProcessor.ConnectionFactoryConfigValidator| Modifier and Type | Field and Description |
|---|---|
(package private) static PropertyDescriptor |
ACKNOWLEDGEMENT_MODE |
(package private) static AllowableValue |
AUTO_ACK |
(package private) static AllowableValue |
CLIENT_ACK |
(package private) static AllowableValue |
DUPS_OK |
(package private) static PropertyDescriptor |
DURABLE_SUBSCRIBER |
(package private) static PropertyDescriptor |
ERROR_QUEUE |
static String |
JMS_MESSAGETYPE |
static String |
JMS_SOURCE_DESTINATION_NAME |
(package private) static PropertyDescriptor |
MESSAGE_SELECTOR |
private static List<PropertyDescriptor> |
propertyDescriptors |
static Relationship |
REL_SUCCESS |
private static Set<Relationship> |
relationships |
(package private) static PropertyDescriptor |
SHARED_SUBSCRIBER |
(package private) static PropertyDescriptor |
SUBSCRIPTION_NAME |
(package private) static PropertyDescriptor |
TIMEOUT |
BYTES_MESSAGE, CF_SERVICE, CHARSET, CLIENT_ID, DESTINATION, DESTINATION_TYPE, JMS_CF_PROPERTIES, JNDI_JMS_CF_PROPERTIES, PASSWORD, QUEUE, SESSION_CACHE_SIZE, TEXT_MESSAGE, TOPIC, USER| Constructor and Description |
|---|
ConsumeJMS() |
| Modifier and Type | Method and Description |
|---|---|
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
protected JMSConsumer |
finishBuildingJmsWorker(org.springframework.jms.connection.CachingConnectionFactory connectionFactory,
org.springframework.jms.core.JmsTemplate jmsTemplate,
ProcessContext processContext)
Will create an instance of
JMSConsumer |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
private static boolean |
isDurableSubscriber(ProcessContext context) |
private static boolean |
isShared(ProcessContext context) |
void |
onSchedule(ProcessContext context) |
protected void |
rendezvousWithJms(ProcessContext context,
ProcessSession processSession,
JMSConsumer consumer)
Will construct a
FlowFile containing the body of the consumed JMS
message (if JMSConsumer.JMSResponse returned by JMSConsumer is not
null) and JMS properties that came with message which are added to a
FlowFile as attributes, transferring FlowFile to
'success' Relationship. |
protected void |
setClientId(ProcessContext context,
org.springframework.jms.connection.SingleConnectionFactory cachingFactory)
Use provided clientId for non shared durable consumers, if not set
always a different value as defined in
AbstractJMSProcessor.setClientId(ProcessContext, SingleConnectionFactory). |
private FlowFile |
updateFlowFileAttributesWithJMSAttributes(Map<String,String> jmsAttributes,
FlowFile flowFile,
ProcessSession processSession)
Copies JMS attributes (i.e., headers and properties) as FF attributes.
|
close, getClientId, getSupportedDynamicPropertyDescriptor, onTrigger, setupConnectionFactoryProvider, setupWorkerPool, shutdownConnectionFactoryProvideronTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatepublic static final String JMS_MESSAGETYPE
static final AllowableValue AUTO_ACK
static final AllowableValue CLIENT_ACK
static final AllowableValue DUPS_OK
public static final String JMS_SOURCE_DESTINATION_NAME
static final PropertyDescriptor MESSAGE_SELECTOR
static final PropertyDescriptor ACKNOWLEDGEMENT_MODE
static final PropertyDescriptor DURABLE_SUBSCRIBER
static final PropertyDescriptor SHARED_SUBSCRIBER
static final PropertyDescriptor SUBSCRIPTION_NAME
static final PropertyDescriptor TIMEOUT
static final PropertyDescriptor ERROR_QUEUE
public static final Relationship REL_SUCCESS
private static final Set<Relationship> relationships
private static final List<PropertyDescriptor> propertyDescriptors
private static boolean isDurableSubscriber(ProcessContext context)
private static boolean isShared(ProcessContext context)
@OnScheduled public void onSchedule(ProcessContext context)
protected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractJMSProcessor<JMSConsumer>protected void rendezvousWithJms(ProcessContext context, ProcessSession processSession, JMSConsumer consumer) throws ProcessException
FlowFile containing the body of the consumed JMS
message (if JMSConsumer.JMSResponse returned by JMSConsumer is not
null) and JMS properties that came with message which are added to a
FlowFile as attributes, transferring FlowFile to
'success' Relationship.rendezvousWithJms in class AbstractJMSProcessor<JMSConsumer>ProcessExceptionprotected JMSConsumer finishBuildingJmsWorker(org.springframework.jms.connection.CachingConnectionFactory connectionFactory, org.springframework.jms.core.JmsTemplate jmsTemplate, ProcessContext processContext)
JMSConsumerfinishBuildingJmsWorker in class AbstractJMSProcessor<JMSConsumer>JMSPublisher,
JMSConsumerpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected void setClientId(ProcessContext context, org.springframework.jms.connection.SingleConnectionFactory cachingFactory)
Use provided clientId for non shared durable consumers, if not set
always a different value as defined in AbstractJMSProcessor.setClientId(ProcessContext, SingleConnectionFactory).
Session.createDurableConsumer(javax.jms.Topic, String, String, boolean),
in special following part: An unshared durable subscription is
identified by a name specified by the client and by the client identifier,
which must be set. An application which subsequently wishes to create
a consumer on that unshared durable subscription must use the same
client identifier.setClientId in class AbstractJMSProcessor<JMSConsumer>context - context.cachingFactory - the connection factory.private FlowFile updateFlowFileAttributesWithJMSAttributes(Map<String,String> jmsAttributes, FlowFile flowFile, ProcessSession processSession)
Copyright © 2021 Apache NiFi Project. All rights reserved.