@Tags(value={"jms","put","message","send","publish"}) @InputRequirement(value=INPUT_REQUIRED) @CapabilityDescription(value="Creates a JMS Message from the contents of a FlowFile and sends it to a JMS Destination (queue or topic) as JMS BytesMessage or TextMessage. FlowFile attributes will be added as JMS headers and/or properties to the outgoing JMS message.") @ReadsAttribute(attribute="jms_deliveryMode",description="This attribute becomes the JMSDeliveryMode message header. Must be an integer.") @ReadsAttribute(attribute="jms_expiration",description="This attribute becomes the JMSExpiration message header. Must be an integer.") @ReadsAttribute(attribute="jms_priority",description="This attribute becomes the JMSPriority message header. Must be an integer.") @ReadsAttribute(attribute="jms_redelivered",description="This attribute becomes the JMSRedelivered message header.") @ReadsAttribute(attribute="jms_timestamp",description="This attribute becomes the JMSTimestamp message header. Must be a long.") @ReadsAttribute(attribute="jms_correlationId",description="This attribute becomes the JMSCorrelationID message header.") @ReadsAttribute(attribute="jms_type",description="This attribute becomes the JMSType message header. Must be an integer.") @ReadsAttribute(attribute="jms_replyTo",description="This attribute becomes the JMSReplyTo message header. Must be an integer.") @ReadsAttribute(attribute="jms_destination",description="This attribute becomes the JMSDestination message header. Must be an integer.") @ReadsAttribute(attribute="other attributes",description="All other attributes that do not start with jms_ are added as message properties.") @ReadsAttribute(attribute="other attributes .type",description="When an attribute will be added as a message property, a second attribute of the same name but with an extra `.type` at the end will cause the message property to be sent using that strong type. For example, attribute `delay` with value `12000` and another attribute `delay.type` with value `integer` will cause a JMS message property `delay` to be sent as an Integer rather than a String. Supported types are boolean, byte, short, integer, long, float, double, and string (which is the default).") @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={ConsumeJMS.class,JMSConnectionFactoryProvider.class}) @SystemResourceConsideration(resource=MEMORY) public class PublishJMS extends AbstractJMSProcessor<JMSPublisher>
Processor which upon each
invocation of AbstractJMSProcessor.onTrigger(ProcessContext, ProcessSession) method will
construct a Message from the contents of the FlowFile sending
it to the Destination identified by the
AbstractJMSProcessor.DESTINATION property while transferring the
incoming FlowFile to 'success' Relationship. If message can
not be constructed and/or sent the incoming FlowFile will be
transitioned to 'failure' RelationshipAbstractJMSProcessor.ConnectionFactoryConfigValidator| Modifier and Type | Field and Description |
|---|---|
(package private) static PropertyDescriptor |
ALLOW_ILLEGAL_HEADER_CHARS |
(package private) static PropertyDescriptor |
ATTRIBUTES_AS_HEADERS_REGEX |
(package private) static PropertyDescriptor |
MESSAGE_BODY |
private static List<PropertyDescriptor> |
propertyDescriptors |
static Relationship |
REL_FAILURE |
static Relationship |
REL_SUCCESS |
private static Set<Relationship> |
relationships |
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 |
|---|
PublishJMS() |
| Modifier and Type | Method and Description |
|---|---|
private byte[] |
extractMessageBody(FlowFile flowFile,
ProcessSession session)
Extracts contents of the
FlowFile as byte array. |
private String |
extractTextMessageBody(FlowFile flowFile,
ProcessSession session,
String charset) |
protected JMSPublisher |
finishBuildingJmsWorker(org.springframework.jms.connection.CachingConnectionFactory connectionFactory,
org.springframework.jms.core.JmsTemplate jmsTemplate,
ProcessContext processContext)
Will create an instance of
JMSPublisher |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
rendezvousWithJms(ProcessContext context,
ProcessSession processSession,
JMSPublisher publisher)
Will construct JMS
Message by extracting its body from the
incoming FlowFile. |
close, customValidate, getClientId, getSupportedDynamicPropertyDescriptor, onTrigger, setClientId, 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, validatestatic final PropertyDescriptor MESSAGE_BODY
static final PropertyDescriptor ALLOW_ILLEGAL_HEADER_CHARS
static final PropertyDescriptor ATTRIBUTES_AS_HEADERS_REGEX
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private static final List<PropertyDescriptor> propertyDescriptors
private static final Set<Relationship> relationships
protected void rendezvousWithJms(ProcessContext context, ProcessSession processSession, JMSPublisher publisher) throws ProcessException
Message by extracting its body from the
incoming FlowFile. FlowFile attributes that represent
standard JMS headers will be extracted from the FlowFile and set
as JMS headers on the newly constructed message. For the list of
available message headers please see JmsHeaders. FlowFile is transferred to the'success'
Relationship and upon failure FlowFile is penalized and
transferred to the 'failure' RelationshiprendezvousWithJms in class AbstractJMSProcessor<JMSPublisher>ProcessExceptionprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected JMSPublisher finishBuildingJmsWorker(org.springframework.jms.connection.CachingConnectionFactory connectionFactory, org.springframework.jms.core.JmsTemplate jmsTemplate, ProcessContext processContext)
JMSPublisherfinishBuildingJmsWorker in class AbstractJMSProcessor<JMSPublisher>JMSPublisher,
JMSConsumerprivate byte[] extractMessageBody(FlowFile flowFile, ProcessSession session)
FlowFile as byte array.private String extractTextMessageBody(FlowFile flowFile, ProcessSession session, String charset)
Copyright © 2021 Apache NiFi Project. All rights reserved.