Calling an Asynchronous Queue in Mendix

Last modified by Danniar Firdausy on 2024/10/03 08:39

With the help of the eMagiz Mendix module created by the eMagiz team, you can easily connect between Mendix and eMagiz for data integration. In this microlearning, we will focus on calling an asynchronous queue in Mendix.

Should you have any questions, please get in touch with academy@emagiz.com.

1. Prerequisites

  • Intermediate knowledge of the eMagiz platform
  • Access to a Mendix application
  • Access to the Deploy phase of your eMagiz project
  • A connection between Mendix and eMagiz Designed and Created
  • Using eMagiz Mendix version 5.0.0 or higher.

2. Key concepts

This microlearning centers around calling an asynchronous queue in Mendix.

  • With eMagiz Mendix Connector, we mean: A Mendix module developed and maintained by eMagiz that simplifies connect a Mendix application to an eMagiz project for data traffic between both systems.

To call an asynchronous queue in Mendix, you need the following:

  • Execute microflow (the microflow that will process the incoming data)
  • Optionally, you can define an import mapping and subsequent option

3. Calling an asynchronous queue in Mendix

With the help of the eMagiz Mendix module created by the eMagiz team, you can easily connect between Mendix and eMagiz for data integration. In this microlearning, we will focus on calling an asynchronous queue in Mendix. For sending data to Mendix, we offer two options to send data:

  • Using the import mapping to send data to Mendix
  • Sending a string message directly to Mendix

Alternatively, you could use the eMagiz Kafka connector to connect to the event broker that eMagiz offers. For more information on that, please check out this [microlearning](intermediate-event-streaming-connectors-using-kafka-module-mendix.md).

Below, we will detail how to configure each option for sending data asynchronously to Mendix.

3.1 Sending asynchronous messages with import mapping

To send data to Mendix, you need to define several configuration options in the exit flow within the eMagiz portal. You want to connect your eMagiz solution to Mendix. In this example, we will look at the configuration for when you want to use the import mapping in Mendix. In the subsequent paragraph, we will take a closer look at how to configure the exit in case you do not want to use the import mapping.

You will see the following overview within the exit flow, which you can configure (if in "Start Editing" mode). Here, you need to define the import mapping (complete name in Mendix including module name) and the execute microflow (complete name in Mendix including module name).

intermediate-mendix-connectivity-calling-an-asynchronous-webservice-in-exit-flow-config.png

When selecting the import mapping, several additional options need to be chosen within the exit. What each specific option does is detailed in the accompanying help text. Below you will see an example of how you could configure this.

intermediate-mendix-connectivity-calling-an-asynchronous-webservice-in-exit-flow-config-import-mapping-specific.png

Note that the Range is a critical piece of the configuration as it defines whether the root of the result of the import mapping is a list (All), a single object (First), or a limited list (Custom). Note that the parameter of your import microflow should match this to prevent errors. So, for example, when your parameter upon the import microflow is an Object, you should select the option First. If the parameter on your import microflow is a List, you should select the option All. In cases where you want to reduce the number of entries in the List, you can use the Custom option to reduce the amount to a predefined limit.

When satisfied with this setup, please create a new version of the flow and include it in your latest release. That will allow Mendix to retrieve the newest version upon the next restart of Mendix (or by manually downloading the release in Mendix).

3.2 Sending asynchronous messages without import mapping

We just saw the example when working with the import mapping. Now we turn our attention to an instance without import mapping. In these cases, the string is just passed to the execute microflow, and you can determine in Mendix yourself what to do with it.

You will see the following overview within the exit flow, which you can configure (if in "Start Editing" mode). Here you need to define the execute microflow (complete name in Mendix including module name).

intermediate-mendix-connectivity-calling-an-asynchronous-webservice-in-exit-flow-config-string.png

When satisfied with this setup, please create a new version of the flow and include it in your latest release. That will allow Mendix to retrieve the newest version upon the next restart of Mendix (or by manually downloading the release in Mendix).

4. Key takeaways

To call an asynchronous queue in Mendix, you need the following:

  • Execute microflow (the microflow that will process the incoming data)
  • Optionally, you can define an import mapping and subsequent option
  • Setting the Range option correctly is critical to prevent 'unexpected' errors

Note: To make a connection in allowing data to travel between A and B, you need to fill in the correct constants and set up your Keystore and Truststore correctly. For more information check out this Novice - Mendix Connectivity microlearnings.

5. Suggested Additional Readings

If you are interested in this topic and want more information, please read the release notes provided by eMagiz that accompany the eMagiz Mendix Connector version you have selected. Furthermore, check out these links: