Events

Pricefx generates various events which can trigger an action by IntegrationManager. The complete list of events in described in the Pricefx documentation

Enable HTTP Events on Pricefx Server

  1. Log in to the required partition.

  2. Go to Administration > Configuration > General Settings and fill in the Event URL field (without some value here the events are not generated):

    • If you use the Pull method – http://dummy_url and check the Disable sending events through HTTP (PUSH) option.

    • If you use the Push method – URL of your event listener or localhost for event route + port

  3. See the log in IM (main.log) whether the event was received. 

 See the Event Admin section to learn how to define events in PlatformManager.

Option 1: Pull Events from PFX to IM

In comparison with the Push method, Pull has the advantage that you can download only the event that you want to process.

To pull events from PFX:

  1. Disable event sending from PFX. Select checkbox in General Settings tab (or in Advanced Configuration Options set the property disabledEventProcessing to true)

  2. In refs/events.xml spring config file set the bean net.pricefx.integration.route.EventRoute.

Example
<bean id="eventRoute" class="net.pricefx.integration.route.EventRoute"> <property name="priceFxClient" ref="pricefxclient"/> <property name="schedulerDelay" value="10000"/> <property name="maxEvents" value="10000"/> <property name="delay" value="5000"/> <property name="deleteCacheFilesAfterProcessing" value="true"/> <property name="eventTypeToRouteMapping"> <map> <entry key="ITEM_APPROVED_PGI" value="direct://ItemApprovedPGI"/> </map> </property> </bean>

Event Route Properties

Property

Default

Description

Property

Default

Description

priceFxClientName



Name of the PriceFxClient bean. Use this or priceFxClient.

priceFxClient



Reference to the PriceFxClient bean. Use this or priceFxClientName.

schedulerDelay



Delay for pull events from PFX. Default values is 10s

maxEvents



Maximum number of events that are pulled from PFX during one connection.

cacheFolder

{default TMP folder}/camel/pfxEvent-{profileName}

Cache folder for files with incoming PFX events.

delay

10000

Delay for reading files from the cache folder.

archiveFolder

{default TMP folder}/camel/pfxEvent-{profileName}/archive

Folder for archived processed files with an event.

errorFolder

{default TMP folder}/camel/pfxEvent-{profileName}/error

Folder for not correctly processed files with an event.

deleteCacheFilesAfterProcessing

true

If the file in the cache folder is successfully processed, it is removed from the cache folder.

eventTypeToRouteMapping

empty map

Map of event names and their endpoints.

extractDataFromEvent

false

Extracts from the event JSON message data part and saves it to the exchange message.

jsonParserName

gson

The JSON parser that will be used during the event JSON message processing. Possible values are gson and jackson.

initialDelay (available from 4.10.7 and 5.2.0)

1000

Sets an initial delay before the first event is pulled from Pricefx. The value is in milliseconds.

Auto Configuration

Since the version 1.1.6, it is possible to configure the event pull system directly in the application properties (instead of using the bean net.pricefx.integration.route.EventRoute).

Class

Bean Name

Description

Class

Bean Name

Description

net.pricefx.integration.route.PerEventTypeEventRoute

perEventTypeEventRoute

If the bean with the name eventListener exists in the Spring context, it is not started.

 

Property

Default Value

Description

Property

Default Value

Description

integration.events.enabled

true

If false, the event route beans are not started automatically.

integration.events.schedulerDelay

5000

Sets an interval how frequently IM pulls new events from PFX and saves them to a file.

integration.events.delay

10000

Sets an interval how often the saved events should be read from the file. 

integration.events.maxEvents

1000



integration.events.event-to-route-mapping.<EVENT_TYPE>

Default value is an empty map of event types to camel endpoints

Use this property to define mapping of event types to Camel endpoints.

Example
integration.events.event-to-route-mapping.ITEM_UPDATE_PPV=direct:eventQuote integration.events.event-to-route-mapping.PADATALOAD_COMPLETED=direct:eventQuote integration.events.event-to-route-mapping.CALCULATION_COMPLETED_CFS=direct:eventQuote

 

integration.events.cache-folder

 

 

integration.events.json-parser

 

 

integration.events.connection

pricefx

The name of Pricefx connection used for event fetch.

integration.events.initial-delay (from 4.10.7 and 5.2.0)

1000

Sets an initial delay before the first event is pulled from Pricefx. The value is in milliseconds.

Option 2: Push Events from PFX to IM

IM listens on the event channel and performs actions based on the specific implementation. Every incoming event is stored in a temporary cache folder and from this folder it is processed after a specified delay.

Parameter

Default

Description

Parameter

Default

Description

httpPort

null

Pricefx event channel HTTP port

httpHost

0.0.0.0

Pricefx event channel HTTP host

cacheFolder

{default TMP folder}/camel/pfxEvent-{profileName}

Cache folder for files with incoming PFX events

delay

10000

Delay for reading files from the cache folder

archiveFolder

{default TMP folder}/camel/pfxEvent-{profileName}/archive

Folder for archived processed files with an event

errorFolder

{default TMP folder}/camel/pfxEvent-{profileName}/error

Folder for not correctly processed files with an event

deleteCacheFilesAfterProcessing

true

Determines if processed files should be removed if the archiveFolder is not specified

 

For example, you want to be notified about an item approval in a price grid. The event name is ITEM_APPROVED_PGI. 

<bean id="eventListener" class="net.pricefx.integration.route.EventListener"> <property name="httpPort" value="1081"/> <property name="eventTypeToRouteMapping"> <map> <entry key="CALCULATION_COMPLETED_CFS" value="direct://CFSCompleted"/> <entry key="ITEM_APPROVED_PGI" value="direct://ItemApprovedPGI"/> </map> </property> </bean>

Send EVENT on Integration Machine to Test Listener

Send EVENT with CURL

Checking of Stuck/Blocked Unprocessed Events

Property

Default Value

Description

Property

Default Value

Description

integration.events.check-stuck-processing.enabled

true

If true, stuck events will be checked.

integration.events.check-stuck-processing.scheduled-ms

7 200 000

Sets an interval how frequently IM checks stuck events (in ms). The default value is 2 hours.

integration.events.check-stuck-processing.timeout-duration

24

Defines a limit when an event is considered stuck. The default value is 24 hours.

integration.events.check-stuck-processing.timeout-unit

h

Defines the unit. Possible values: d (day), h (hour), m (minute), s (second).

When some stuck event is found, a summary email is sent. For this reason, error-handling email is used. Thus error-handling must be enabled in order to receive such summary. Otherwise, the summary can be found in the logs.

IntegrationManager version 5.0.0