Configuring Event Publishing for On-Premises Environments

When you enable and activate the Event Publishing app, all default event types are available in the OOTBEvents object. 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 inEvent Publishing.

If you have already created and implemented event publishing, Event Publishing ignores the OOTBEvents object, nor does it override any configured events.

Important: The OOTBEvents object is a proprietary file and you should not modify it. To customize, edit the EventPublishDictionary.

Important: Complete all the tasks that this page discusses in the order listed.

This task shows you how to:

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.

  1. Open MQL and run the following commands.

    set context user administrator;
    verbose on;
    modify page EventPublishDictionary file "<server>/EventPublishDictionary.json"; 

  2. 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"]
                }]
           }	]
    } 

  3. 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.

  1. 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";

  2. 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.

  1. 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";

  2. Open the EventPublishConfig.xml file and update the following keys in the page object EventPublishConfig.
    OptionDescription
    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.

  1. Create a sample class to configure the message broker.

    For example, KafkaPublishedImpl.java.

  2. 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

  3. Implement interface methods.
    1. Import the required java classes.
    2. Import the interface.

      com.dassault_systemes.eventpublishing.messaging.common.EventsProducerClient

    3. Implement interface methods.

      public Object createProducer();
      public boolean sendMessage(Object producer, String message, String destName, HashMap<String,String> metadataMap);
      public boolean closeProducer(Object producer);

  4. 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.

    1. Change directory to temp.

      cd /home/data/RTV/temp

    2. Compile the created java class.

      javac -cp .:/home/data/RTV/<server>/apache-tomcat/webapps/3DSpace/WEB-INF/lib/* com/dassault_systemes/eventpublishing/KafkaPublisherImpl.java

  5. Create the jar from the compiled class.
    1. Change directory to temp

      cd /home/data/RTV/temp

    2. Compile the created java class.

      jar cvf customMQ.jar com/dassault_systemes/eventpublishing/*.cl

      customMQ.jar appears in /home/data/RTV/temp.

  6. Deploy the created jar in tomcat and in javaserver.
    1. Copy jar file to 3DSpace lib.

      {Tomcat}/webapps/3DSpace/WEB-INF/lib
      /home/data/RTV/<server>/apache-tomcat/webapps/3DSpace/WEB-INF/lib

    2. 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

  7. Restart the Tomcat server.
  8. 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";

  9. Open the EventPublishConfig.xml file and update the following keys in the page object EventPublishConfig.
    OptionDescription
    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.

  1. Run the helper updateCronTab.sh with the required parameters.
    1. Navigate to the install directory.

      For example, /home/data/RTV/<env_name>/server/scripts.

    2. 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.

    3. Verify the crontab to confirm the changes.

      crontab -l
      Note: If you receive a permission denial error, grant rwx permissions to both these script files (updateCronTab.sh and startEPSPublishIndex.sh).

  2. Do the following to directly update the CronTab.
    1. 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

    2. 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.

  1. Use Windows Scheduler to automate the startEPSPublishIndex.bat script.

    The startEPSPublishIndex.bat file is present in <INSTALLDIR>\<OS>\code\command.

  2. In Task Scheduler Actions, specify the MQL path as the argument.

    For example, F:\enoviaV6R2021x\server\win_b64\code\bin.

  3. Configure the Task Scheduler trigger to repeat the task every 5 minutes to run the batch file every 5 minutes.