date segment extractor

Date Segment Extractor

Version: 17.07

Supported Since: 17.07

What is a Date Segment Extractor?

Date Segment Extractor processing element can be used to extract parts of a given input date string. The input can be set as a message context scope variable, message property, message transport header or users can directly provide the relevant date string as a property to the processing element configuration. If you are using a scope variable or a message property to provide the input date it can be a java.util.Date type or java.lang.String type. In the processing element configuration you can define the segment to be extracted from the provided date. Also you can define where the resultant segment should be allocated to, ie: to a scope variable, message property or a message header, and the name of the parameter which will hold the result.

Out Ports

date seg ex outports

Next

The processing element will extract the specified date segment from the input date, assign it to a variable/property/header and then it will be forwarded to this out port

On Exception

The message will be sent to this outport if any exception occurred while extracting the requested segment from the input date

Parameters

Input Type

Using this property you need to define how will you provide the date. From the dropdown menu you will be able to select on of the following options.

* HEADER * PROPERTY * CONTENT * VARIABLE

Date String

If you select "CONTENT" from the "Input Type" dropdown you need to provide the date string needs to be used as the input date

Variable Name

If you select "VARIABLE" from the "Input Type" dropdown you need to provide name of the scope variable which needs to be used as the input date

Variable Type

If you select "VARIABLE" from the "Input Type" dropdown you need to provide type of the scope variable by selecting from dropdown menu, ie: whether it is going to be a "STRING" or a "DATE"

Header Name

If you select "HEADER" from the "Input Type" dropdown you need to provide name of the transport header which needs to be used as the input date

Property Name

If you select "PROPERTY" from the "Input Type" dropdown you need to provide name of the message property which needs to be used as the input date

Property Type

If you select "PROPERTY" from the "Input Type" dropdown you need to provide type of the message property by selecting from dropdown menu, ie: whether it is going to be a "STRING" or a "DATE"

Original Date Pattern

If you are providing a date string then it is required to provide the pattern of the provided date string. From the dropdown list you should select on the following date patterns supported by org.apache.commons.lang3.time.FastDateFormat

* yyyy-MM-dd’T’HH:mm:ss * yyyy-MM-dd’T’HH:mm:ssZZ * yyyy-MM-dd * yyyy-MM-ddZZ * 'T’HH:mm:ss * 'T’HH:mm:ssZZ * HH:mm:ss * HH:mm:ssZZ * EEE, dd MMM yyyy HH:mm:ss Z

Segment to Extract

Here you need to select the segment to be extracted from the provided date. Following are the segments that are facilitated to be extracted from the date.

* ERA * YEAR * MONTH * WEEK OF YEAR * WEEK OF MONTH * DAY OF YEAR * DAY OF MONTH * DAY OF WEEK * HOUR (24h) * HOUR (12h) * MINUTES * SECONDS * MILLISECONDS * TIME ZONE OFFSET * AM/PM

Output Type

Using this property you need to define how you needs to assign the date segment extraction result. From the dropdown menu you will be able to select one of the following options.

* HEADER * PROPERTY * VARIABLE

Variable Name to Assign Transformed Date

If you select "VARIABLE" from the "Output Type" dropdown you need to provide name of the scope variable which needs to be used to assign the extracted date segment

Header Name to Assign Transformed Date

If you select "HEADER" from the "Output Type" dropdown you need to provide name of the transport header which needs to be used to assign the extracted date segment

Property Name to Assign Transformed Date

If you select "PROPERTY" from the "Output Type" dropdown you need to provide name of the message property which needs to be used to assign the extracted date segment

Sample Use Case

The following simple use case describes how you can receive a HTTP message which contains a transport header with a timestamp value and how you can extract different segments of that timestamp header to use in your custom logic. In this case extracted segment will be assigned to a message context scope variable.

date seg ex flow

In the above flow, through HTTP Ingress Connector element messages will be received to the flow. Each message will have a transport header "timestamp" that contains a date value. From that date Date Segment Extractor processing element will extract the year and assign it to a scope variable of name "segmentValue".

Following images depicts configuration of the processing element.

date seg ex inputs
date seg ex outputs

After extraction the year of the provided date will be assigned to a scope variable as depicted in the following image.

date seg ex result

After extracting the year, in this simple message flow, the message will be forwarded to the backend server through a HTTP Egress Connector.

In this topic
In this topic
Contact Us