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
Log in to the required partition.
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
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:
Disable event sending from PFX. Select checkbox in General Settings tab (or in Advanced Configuration Options set the property
disabledEventProcessing
totrue
)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 |
---|---|---|
| Name of the PriceFxClient bean. Use this or priceFxClient. | |
| Reference to the PriceFxClient bean. Use this or priceFxClientName. | |
| Delay for pull events from PFX. Default values is 10s | |
| Maximum number of events that are pulled from PFX during one connection. | |
| {default TMP folder}/camel/pfxEvent-{profileName} | Cache folder for files with incoming PFX events. |
| 10000 | Delay for reading files from the cache folder. |
| {default TMP folder}/camel/pfxEvent-{profileName}/archive | Folder for archived processed files with an event. |
| {default TMP folder}/camel/pfxEvent-{profileName}/error | Folder for not correctly processed files with an event. |
| true | If the file in the cache folder is successfully processed, it is removed from the cache folder. |
| empty map | Map of event names and their endpoints. |
| false | Extracts from the event JSON message data part and saves it to the exchange message. |
| gson | The JSON parser that will be used during the event JSON message processing. Possible values are gson and jackson. |
| 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 |
---|---|---|
net.pricefx.integration.route.PerEventTypeEventRoute | perEventTypeEventRoute | If the bean with the name |
Property | Default Value | Description |
---|---|---|
| true | If false, the event route beans are not started automatically. |
| 5000 | Sets an interval how frequently IM pulls new events from PFX and saves them to a file. |
| 10000 | Sets an interval how often the saved events should be read from the file. |
| 1000 | |
| Default value is an empty map of event types to camel endpoints | Use this property to define mapping of event types to Camel endpoints. Exampleintegration.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
|
|
|
|
|
|
|
| pricefx | The name of Pricefx connection used for event fetch. |
| 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 |
---|---|---|
| null | Pricefx event channel HTTP port |
| 0.0.0.0 | Pricefx event channel HTTP host |
| {default TMP folder}/camel/pfxEvent-{profileName} | Cache folder for files with incoming PFX events |
| 10000 | Delay for reading files from the cache folder |
| {default TMP folder}/camel/pfxEvent-{profileName}/archive | Folder for archived processed files with an event |
| {default TMP folder}/camel/pfxEvent-{profileName}/error | Folder for not correctly processed files with an event |
| 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 |
---|---|---|
| true | If true, stuck events will be checked. |
| 7 200 000 | Sets an interval how frequently IM checks stuck events (in ms). The default value is 2 hours. |
| 24 | Defines a limit when an event is considered stuck. The default value is 24 hours. |
| 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.8.0