PortX JD Edwards Connector for Mule 4 – Demo – Poll Transaction (MBF) Events
Introduction
The PortX JDE Connector leverages the internal capabilities of Oracle’s JD Edwards EnterpriseOne™ solution to a broader extent, and uses the power of Oracle’s Java Dynamic Connector to provide interoperability with JD Edwards EnterpriseOne™ and external systems.
After reading this guide, you should be able to poll for transaction (Master Business Function) events created on the server.
At design time, the PortX JDE Connector allows you to discover functions by name providing full access to all Business Function signatures. Given that discovery is a heavy duty process, the Connector manages a cache repository for all function’s metadata used at least once.
The results of a function call will be injected into the flow as a Map containing key-value pairs with the invocation’s output values. This approach gives the end user freedom of choice to construct complex flows and manage custom exception strategies.
Furthermore, you can have all functions in the flow, processing within the same transaction, and commit or rollback all changes.
Prerequisites
This document assumes that you are familiar with Oracle’s JD Edwards EnterpriseOne™ basics, Mule the Anypoint™ Studio interface.
Requirements
Review the PortX JDE Connector for Mule 4 – Getting Started Guide for a detailed list of requirements and setup prerequisites.
JDE outbound transactions requires that you set a *Processing Option* specifying a transaction type. Additionally, some entry programs enable you to specify a version of the Master Business Function Processing Options program that, in turn, enables you to specify a version of the Interoperability Processing Options program.
For example, to get customer entered by the application *Customer Master Information* (P03013) it is necessary to setup it’s processing options to enable interoperability. To do this you will need to log into JDE, and change the processing options for this application. Firstly, we need to determine which version of the Master Business Function is being called by the application. To do this, we will need to review the processing options.
The Customer Master Business Function version that is used for the version of the application is ZJDE0002, so we need to now review the Customer Master MBF (P0100042) processing options.
If the Transaction Type is not yet set, we need to set it to the appropriate value.
For more on setting transaction types, please refer to the Oracle JD Edwards EnterpriseOne documentation
Demo – Poll Transaction (MBF) Events
It is recommended that you update AnyPoint Studio before starting with a PortX JDE Connector project. |
Creating a new Mule Project
Create a new Mule Project with Mule Server 4.1.1 EE or greater as runtime:
Project Dependencies
In you pom.xml, add the following to you repositories section :
<repository>
<id>portx-repository-releases</id>
<name>portx-repository-releases</name>
<url>https://portx.jfrog.io/portx/portx-releases</url>
</repository>
Add the following to you dependencies section :
<dependency>
<groupId>com.modus</groupId>
<artifactId>mule-jde-connector</artifactId>
<version>2.0.0</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>com.jdedwards</groupId>
<artifactId>jde-lib-bundle</artifactId>
<version>1.0.0</version>
<classifier>mule-4</classifier>
</dependency>
Add or update the following to you plugins section :
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>$\{mule.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<sharedLibraries>
<sharedLibrary>
<groupId>com.jdedwards</groupId>
<artifactId>jde-lib-bundle</artifactId>
</sharedLibrary>
</sharedLibraries>
</configuration>
</plugin>
Required files
Copy the JD Edwards EntrpriseOne™ configuration files to the following folders within the project:
-
Project Root
-
src/main/resources
If there is a requirement to use different configuration files per environment, you may create separate folders under src/main/resources corresponding to each environment as shown below. |
The mule-arifact.json file needs to be updated per environment as below
{
"minMuleVersion": "4.1.4",
"classLoaderModelLoaderDescriptor": {
"id": "mule",
"attributes": {
"exportedResources": [
"JDV920/jdeinterop.ini",
"JDV920/jdbj.ini",
"JDV920/tnsnames.ora",
"JPY920/jdeinterop.ini",
"JPY920/jdbj.ini",
"JPY920/tnsnames.ora",
"jdelog.properties",
"log4j2.xml"
],
"exportedPackages": [
"JDV920",
"JPY920"
],
"includeTestDependencies": "true"
}
}
}
Other Considerations
To redirect the JD Edwards EntrpriseOne™ Logger to Mule Logger (allowing you to see the JDE activity in both Console and JDE files defined in the jdelog.properties, you may add the following Async Loggers to log4j2.xml file.
<!-- JDE Connector wire logging -->
<AsyncLogger name="org.mule.modules.jde.handle.MuleHandler" level="INFO" />
<AsyncLogger name="org.mule.modules.jde.JDEConnector" level="INFO" />
Troubleshooting
If you are having trouble resolving all dependencies,
-
Shut down AnyPoint Studio
-
Run the following command in the project root folder from the terminal/command prompt,
mvn clean install
-
Open AnyPoint Studio and check dependencies again.
Configure the Global Element
To use the PortX JDE Connector in your Mule application, you must configure a global element that can be used by the connector (read more about Global Elements).
Open the Mule flow for the project, and select the Global Elements tab at the bottom of the Editor Window.
Click Create
Type “JDE” in the filter edit box, and select “JDE Config”. Click OK
On the General tab, enter the required credential and environment
Click Test Connection. You should see the following message appear.
You are now ready to start using the PortX JDE Connector in your project
Creating a Scheduler for your flow
NOTE : This use case example will create a simple flow to poll for outbound events coming from an application that uses a Customer Master Business Function to generate transactions, and write these to files (Please check the requirements section earlier in the document for setup details)
Go back to the Message Flow tab
From the Mule Palette (typically top right), select Scheduler, and drag it to the canvas
Select the Scheduler component from the canvas, and inspect the properties window, and change the Frequency to 2ms
Poll for Transaction (MBF) Events
Locate the JDE Connector, and select Poll Events. Drag this to the canvas.
Drag the connector over to the canvas. Select it and review the properties window. Give it a meaningful name eg. Call Poll Customer Master Events.
Under the General section, click on the drop-down for Operation Name, and select Capture Event Transactions.
You may now assign the input parameters. You can do this by either entering the payload values manually, or via the “Show Graphical View” button.
Drag the inputs to outputs, or double-click the output parameter to add to your edit window, and change as required.
Troubleshooting
If the operation fails (possibly due to a timeout), you will see the below message
Please review the timeout settings in Anypoint Studio's Preferences.
To do this go the the Window > Preferences menu
Go to Anypoint Studio > DataSense and change the DataSense Connection Timeout setting as below
Go to Anypoint Studio > Tooling and change the Default Connection Timeout and Default Read Timeout settings as below
Set Payload Output
In the Mule Palette, you can either select Core, scroll down to Transformers or type “Payload” in the search bar.
Drag and drop the Set Payload to your canvas.
Select the Set Payload component, and review the properties.
Change the payload to reflect the desired output, and save the project
On the MIME Type tab, select application/xml
Next we need to check that Transactions were polled, and exist. From the Mule Palette, Select and drag the Choice component.
Select the When statement, and review the properties. Enter the below expression to check that transactions exist.
We also want to see when the Scheduler returned no transactions, so we will add a logger to the Default condition. From you Mule Palette, drag the logger component to the canvas
Select and review the properties, and enter an appropriate message
If transactions were retrieved (When condition is true) we need to iterate over all the transactions that have been retrieved. For this we will drag the For Each component from out palette, to our canvas.
Select the component, and review the properties.
In Collection enter the Transaction Collection as below
Now drag the Set Variable component to your canvas, select and review the properties
Set the variable name and click on Show Graphical View
Set the Variable value to the filename we want to create, and click on Done.
From your Mule Palette, Select the File > Write component, and drag it to the canvas
Select and review the Properties. Under the Basic Settings, Click the Add button next to Connector configuration.
In the Working Directory field, enter the path where you want to write the file to, and click OK.
Under the General section, click the Switch to expression button, and enter the variable name.
Testing the Mule Flow
To Test your flow, you need to start the Mule application. Go to the Run menu, and select Run.
After the project has been deployed, you can test you flow by logging into JDE. Go to the Customer Master Information Application (P03013 ZJDE0002)
This needs to be a version that has been configured for interoperability (see the Requirements section of this document) |
Make a change to the customer, and check your output path for a created file.
The Transaction XML has been write to the file.
Handling exceptions
From your Mule Pallete, select and drag the Error Handler to your canvas
Now select and drag the On Error Continue into the Error Handler
Select the On Error Continue scope, and under Type enter JDE:ERROR_PROCESSING_POLL_EVENT
NOTE : The operation error types can be seen when selecting the operation on your canvas, going to Error Mapping, and clicking add. You may also map this error to a aplication specific error.
Drag the Set Payload component to the Error Handler, and set an appropriate message