Configure Event Mapping
If you want to customize (add/remove/edit) the provided default event types, you must
configure event type mapping in the EventPublishDictionary page object to
view these events in Event Publishing.
-
Open MQL and run the following commands.
set context user administrator;
verbose on;
modify page EventPublishDictionary file "<server>/EventPublishDictionary.json";
|
-
Edit the dictionary file
EventPublishDictionary.json and add the
required event types in the following format.
Note:
For information about all default supported types, see step 3.
{
"Services" : [
{
"ServiceName" : "3DSpace",
"SupportedClasses" : ["Document","Change","Engineering Item", "Manufacturing Item", "Manufacturing Process", "dsxcad", "Change Order"],
"resourceURI" : "/resources/v1/application/lifecycle/events/changeState",
"dsxcad":[{
"supportedEvents" : ["created","statusChanged"]
}],
"Change":[{
"supportedEvents" : ["created", "statusChanged"]
}],
"Change Order":[{
"supportedEvents" : ["created", "statusChanged"]
}],
"Document":[{
"supportedEvents" : ["created", "statusChanged"]
}],
"Engineering Item":[{
"supportedEvents" : ["created","statusChanged"]
}],
"Manufacturing Item":[{
"supportedEvents" : ["created","statusChanged"]
}],
"Manufacturing Process":[{
"supportedEvents" : ["created","statusChanged"]
}]
} ]
}
|
-
Open MQL and run the following commands to get the default event type mapping
list:
set context user administrator;
verbose on;
print page OOTBEvents select content dump output "<server>/OOTBEvents.json";
|
Configure Generic Trigger for Target Type
When you need to publish events when certain actions occur, the 3DEXPERIENCE platform calls the Event Publishing API with the message payload.
Currently, a generic trigger builds the message payload and calls the Event Publishing API.
The following information applies to the generic trigger:
- The types that generate events can either use the generic trigger or you can create a
new trigger.
- You can use the generic trigger by updating it for the corresponding type. This only
applies to create and status-change events for 3DSpace
types.
- The type must be in a package to configure a generic trigger. Associate types with a
package so that events generate successfully for that type.
- You can create a new trigger or post-process logic to build the message payload and call
the Event Publishing API.
-
To configure a generic trigger for the target type, open MQL and run the following
commands.
set context user administrator;
verbose on;
modify type "Document" add trigger "Transaction" action "emxTriggerManager" input "TypeAllLifecycleTransactionEvent";
|
-
Reload the cache.
Message Payload Format
In the case of a new trigger or post process logic, you can define the message payload in
the following format to call the Event Publishing API.
{
"specversion": "1.0.0",
"source": "https://3dspace.mydomain:443/3dspace/",
"type": "created",
"id": "B2ED0428C16D000061B32EC40001FBB5",
"time": "2021-12-10T10:41:08.039+0000",
"timestamp": 1639132868039,
"metadata": {
"serviceId": "3DSpace",
"geoId": "EWX",
"tenantId": "R2130001395150"
},
"contenttype": "application/json",
"data": {
"eventClass": "Document",
"eventType": "created",
"eventTime": 1639132868039,
"user": "user1",
"authorization": "ctx::Role.Organization.CollaborativeSpace",
"subject": {
"source": "https://3dspace.mydomain:443/3dspace/",
"type": "Document",
"identifier": "B2ED0428C16D000061B32EA9001B0BD0",
"relativePath": "/resources/v1/modeler/documents/B2ED0428C16D000061B32EA9001B0BD0"
}
}
}
|
Configure Message Broker ActiveMQ
You can configure the default message broker ActiveMQ to use in Event Publishing.
Clients must configure the message broker, and you must update the broker details in the
corresponding page object EventPublishConfig.
Event Publishing provides the implementation to create a connection and publish messages to the target
destination only for the ActiveMQ message broker.
-
Open MQL and run the following commands.
set context user administrator;
verbose on;
print page EventPublishConfig select content dump output "<server>/EventPublishConfig.xml";
modify page EventPublishConfig file "<server>/EventPublishConfig.xml";
|
-
Open the
EventPublishConfig.xml file and update the following keys
in the page object EventPublishConfig.
| Option | Description |
|---|
| EventPublish.config.customBroker.ImplClass |
Add the implementation class name if you configured any other message broker.
Not applicable for ActiveMQ broker. |
| EventPublish.config.brokerURL |
The complete messaging broker URL. |
| EventPublish.config.destination |
The messaging destination address (queue/topic name). |
| EventPublish.config.destinationType |
The messaging protocol (queue/topic). |
Configure Message Broker Kafka
You can configure and use the message broker Kafka instead of ActiveMQ.
If you want to use any other message broker, you must create the corresponding
implementation class, which implements the interface
EventsProducerClient.
Clients must configure the message broker and update broker details in the corresponding
page object EventPublishConfig.
-
Create a sample class to configure the message broker.
For example, KafkaPublishedImpl.java.
-
Create a folder structure according to the package specified in the class and copy
the java file.
You can create the folder structure under any directory. For example,
/home/data/RTV/temp. Package :
com.dassault_systemes.eventpublishing
-
Implement interface methods.
-
Import the required java classes.
-
Import the interface.
com.dassault_systemes.eventpublishing.messaging.common.EventsProducerClient
-
Implement interface methods.
public Object createProducer();
public boolean sendMessage(Object producer, String message, String destName, HashMap<String,String> metadataMap);
public boolean closeProducer(Object producer);
-
Compile the java class with prerequisite jars.
Specify the path to the interface
(<tomcat_dir>/webapps/3DSpace/WEB-INF/lib/) and the path for
the interface implementation class. For example,
KafkaPublisherImpl.java.
-
Change directory to temp.
cd /home/data/RTV/temp
-
Compile the created java class.
javac -cp .:/home/data/RTV/<server>/apache-tomcat/webapps/3DSpace/WEB-INF/lib/* com/dassault_systemes/eventpublishing/KafkaPublisherImpl.java
-
Create the jar from the compiled class.
-
Change directory to temp
cd /home/data/RTV/temp
-
Compile the created java class.
jar cvf customMQ.jar com/dassault_systemes/eventpublishing/*.cl
customMQ.jar appears in
/home/data/RTV/temp.
-
Deploy the created jar in tomcat and in javaserver.
-
Copy jar file to 3DSpace lib.
{Tomcat}/webapps/3DSpace/WEB-INF/lib
/home/data/RTV/<server>/apache-tomcat/webapps/3DSpace/WEB-INF/lib
-
Copy the jar file to the following location.
On Windows:
{Application Folder}/server/win_b64/docs/javaserver
On Linux:
{Application Folder}/server/linux_a64/docs/javaserver
-
Restart the Tomcat server.
-
Open MQL and run the following commands.
set context user administrator;
verbose on;
print page EventPublishConfig select content dump output "<server>/EventPublishConfig.xml";
modify page EventPublishConfig file "<server>/EventPublishConfig.xml";
|
-
Open the
EventPublishConfig.xml file and update the following keys
in the page object EventPublishConfig.
| Option | Description |
|---|
| EventPublish.config.customBroker.ImplClass |
Add the implementation class name if you configure any other message
broker. |
| EventPublish.config.brokerURL |
The complete messaging broker URL. |
| EventPublish.config.destination |
The messaging destination address (queue/topic name). |
| EventPublish.config.destinationType |
The messaging protocol (queue/topic). |
Setup Indexer on Linux
You can configure the indexer before you start using Event Publishing. On Linux, you can either run the helper or update the CronTab directly.
The cloudview indexer publishes indexing information to the corresponding Event Publishing
API that reads the Index data and publish indexed events.
-
Run the helper updateCronTab.sh with the required parameters.
-
Navigate to the install directory.
For example,
/home/data/RTV/<env_name>/server/scripts.
-
Run the following command with two parameters.
./updateCronTab.sh <application_path> <mql_path>
|
Syntax for the app's path: /home/data/RTV/<env_name>.
Syntax for MQL path:
/home/data/RTV/<env_name>/server/scripts.
-
Verify the crontab to confirm the changes.
Note:
If you receive a permission denial error, grant
rwx permissions to both these script files
(updateCronTab.sh and
startEPSPublishIndex.sh).
-
Do the following to directly update the CronTab.
-
Declare the EPS Publisher script in crontab. Add the EPS Publisher script to the
crontab using the following command.
$ crontab -e
Uncomment or add the following
line. */5 * * * * <APP Install
Path>/server/scripts/startEPSPublishIndex.sh >> /tmp/EPSProcessEvents.log
2>&1
-
View the logs.
Events appear in /tmp/EPSProcessEvents.log.
Setup Indexer on Windows
You can configure the indexer before you start using Event Publishing.
The cloudview indexer publishes indexing information to the corresponding Event Publishing
API that reads the Index data and publish indexed events.
-
Use Windows Scheduler to automate the startEPSPublishIndex.bat
script.
The startEPSPublishIndex.bat file is present in
<INSTALLDIR>\<OS>\code\command.
-
In Task Scheduler Actions, specify the MQL path as the argument.
For example, F:\enoviaV6R2021x\server\win_b64\code\bin.
-
Configure the Task Scheduler trigger to repeat the task every 5 minutes to run the
batch file every 5 minutes.
|