External Messaging Administrationenterprise-icon heading-link-icon

 CorDapp Corda Distributed Application. A Java (or any JVM targeting language) application built using the Corda build toolchain and CorDapp API to solve some problem that is best solved in a decentralized manner. flows can send simple messages via Kafka The means by which Corda workers communicate, acting as a central message bus between the worker processes. to external systems. For more information, see External Messaging CorDapps. This section describes the cluster administration tasks required for CorDapps that implement external messaging. It contains the following:

The externalMessaging configuration section specifies how Corda creates the required messaging routes when creating a new virtual node. You can update these using the config endpoint of the REST API. For example:

curl -k -u $REST_API_USER:$REST_API_PASSWORD -X PUT -d '{"section":"corda.externalMessaging", "version":"1", "config":"{"routeDefaults": {"active": false,"inactiveResponseType": "IGNORE","receiveTopicPattern": "ext.$HOLDING_ID.$CHANNEL_NAME.receive"}", "schemaVersion": {"major": 1, "minor": 0}}' "$REST_API_URL/config"
Invoke-RestMethod -SkipCertificateCheck -Headers @{Authorization=("Basic {0}" -f ${REST_API_USER}:${REST_API_PASSWORD})} -Method Put -Uri "$REST_API_URL/config" -Body (ConvertTo-Json -Depth 4 @{
section = "corda.messaging"
version = 1
{
    "config": "{
        "routeDefaults": {
            "active": false,
            "inactiveResponseType": "IGNORE",
            "receiveTopicPattern": "ext.$HOLDING_ID.$CHANNEL_NAME.receive"
        }",
    "schemaVersion": {
        "major": 1,
        "minor": 0
    },
    "section": "corda.messaging",
    "version": 1
})

Corda does not create Kafka topics used for external messaging. You must manually create a Kafka topic for each active and current route created for a virtual node The combination of the context of a user and the ephemeral compute instances created to progress a transaction on that identity's behalf. . To determine the required topics and create these topics, do the following:

  1. Retrieve the configuration of the virtual node. For more information, see Retrieving Virtual Nodes. If a CorDapp that implements external messaging is uploaded to a virtual node, the routes configuration is included in the response. For example:

    {
      "virtualNodes": [
        {
          ...
          "externalMessagingRouteConfiguration": {
            "currentRoutes": {
              "cpiIdentifier": {
                "name": "upgrade-testing-cordapp_ea6732c2-183a-4158-a9f0-7fe1084e8ee9",
                "version": "v1",
                "signerSummaryHash": "SHA-256:E53DA5C67A637D42335808FA1534005281BAE7E49CCE8833213E58E0FDCA8B35"
              },
              "routes": [
                {
                  "channelName": "external_app_v1",
                  "externalReceiveTopicName": "ext.B5C16DBC7BB5.external_app_v1.receive",
                  "active": true,
                  "inactiveResponseType": "ERROR"
                }
              ]
            },
            "previousVersionRoutes": []
          }
        }
      ]
    }
    

    The externalMessagingRouteConfiguration field contains the configuration for the routes that were generated for each channel. The currentRoutes field specifies the current configuration while the previousVersionRoutes field contains historical configuration. The previousVersionRoutes field shows how the configuration has evolved over time, which can be useful when troubleshooting issues.

  2. Manually create a Kafka topic for each route returned in externalMessagingRouteConfiguration.currentRoutes.routes. In the example above, create a topic named ext.B5C16DBC7BB5.external_app_v1.receive. For more information, see the Manual Bootstrapping section.

  3. Listen to the Kafka topic for messages using the kafka-console-consumer command. Log in to the pod or container that is running Kafka and execute the following:

    kafka-console-consumer --topic <topic-nam> --from-beginning --bootstrap-server localhost:9092
    

    To test that everything is working correctly, start the flow Communication between participants in an application network is peer-to-peer using flows. that sends external messages. For more information, see the REST API documentation of the flow endpoint.

Was this page helpful?

Thanks for your feedback!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.

We're sorry this page wasn't helpful. Let us know how we can make it better!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Create an issue

Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.