Skip to content

Repository files navigation

graftcode-extensions

Official open-source Graftcode Gateway plugins. Each plugin carries Graft calls over an external channel instead of the Gateway's built-in servers. The Gateway and the calling runtime select a plugin by configuration; they do not share code.

Pick a plugin

Plugin Channel Modes Local setup Docs
rabbitmq RabbitMQ (AMQP 0-9-1) request/reply communication-plugin-samples/rabbitmq Readme
servicebus Azure Service Bus (AMQP 1.0) request/reply and one-way communication-plugin-samples/servicebus Readme
kafka Apache Kafka; Redpanda uses this plugin (Kafka API, host port 19092) request/reply communication-plugin-samples/kafka Readme
sqs Amazon SQS request/reply and one-way communication-plugin-samples/sqs (LocalStack) Readme
pubsub Google Cloud Pub/Sub request/reply and one-way communication-plugin-samples/pubsub (Pub/Sub emulator) Readme
beanstalk beanstalkd request/reply communication-plugin-samples/beanstalk Readme
activemq ActiveMQ (STOMP 1.2) request/reply communication-plugin-samples/activemq Readme
bull Redis lists (Bull names) request/reply communication-plugin-samples/bull Readme
crossbar Crossbar.io (WAMP JSON) request/reply communication-plugin-samples/crossbar Readme
malamute Malamute (ZeroMQ MLP) request/reply communication-plugin-samples/malamute Readme
nats NATS request/reply communication-plugin-samples/nats Readme
nsq NSQ request/reply communication-plugin-samples/nsq Readme
mosquitto Mosquitto (MQTT 5.0) request/reply communication-plugin-samples/mosquitto Readme
pulsar Apache Pulsar request/reply communication-plugin-samples/pulsar Readme
zeromq ZeroMQ (ROUTER/DEALER) request/reply communication-plugin-samples/zeromq Readme
rocketmq Apache RocketMQ 5 (gRPC proxy) request/reply communication-plugin-samples/rocketmq Readme
wire Wire (raw TCP) request/reply communication-plugin-samples/wire Readme
aeron Aeron (UDP unicast) request/reply communication-plugin-samples/aeron Readme

All local Docker setups, ports, and startup instructions are documented in communication-plugin-samples/README.md. Each setup starts its middleware and three Gateway servers consuming from the same request destination. The ZeroMQ sample starts one Gateway and no broker. That process binds the ZeroMQ port. The Wire sample starts one Gateway and no broker. That process binds TCP port 5560. The Aeron sample starts one Gateway and no broker. That process subscribes to UDP 40123.

Payment provider plugins for paid MCP tools (x402 in the Gateway core) live under payment-plugins: zevio (payment.zevio). They are not transport plugins and are loaded through the Gateway --paymentConfig, not --config.

OpenTelemetry / Application Insights lives under observability/opentelemetry. It is not a transport plugin.

Use RabbitMQ or Kafka when you already run that broker. The Kafka plugin also talks to Redpanda, which exposes the Kafka API; the local compose file publishes it on localhost:19092. Use Service Bus or SQS when the deployment is already on Azure or AWS. Use Pub/Sub when the deployment is already on Google Cloud. Use Beanstalk when you already run beanstalkd. SQS and Pub/Sub each need one reply destination per client process; Service Bus can share one session-enabled reply queue. Each Beanstalk client watches its own reply tube. Each Bull client pops its own reply list (bull:graft.replies.<instance>:wait). Use Crossbar when you already run a Crossbar.io router. Several gateways can register the same procedure; the plugin asks the router for round-robin invocations. Use NATS when you already run that broker. Several gateways on the same subject join queue group graft, so one of them receives each request. Each client subscribes to a private inbox _INBOX.<instance>.*. Use NSQ when you already run nsqd. Each client subscribes to its own reply topic (graft_replies_<instance>, channel graft); gateways share channel gg on the request topic. Use Mosquitto when you already run an MQTT broker. Each gateway needs its own request topic, because MQTT delivers a copy of every message to every subscriber. Use Pulsar when you already run that broker. Each client keeps a private subscription on the reply topic and accepts only its correlation-id. Several gateways share the subscription graft-gateway on the request topic. Use ZeroMQ when the client connects straight to the gateway over TCP. The gateway binds one ROUTER socket (tcp://*:5555 by default) and each client connects with a DEALER. Each gateway process needs its own port. Use Aeron when the client sends to the gateway over UDP unicast. There is no broker: the gateway subscribes to 127.0.0.1:40123 and each client binds its own reply port. Each process starts its own media driver. Use Wire when the client connects straight to the gateway over a raw TCP socket. The gateway binds 127.0.0.1:5560 by default, and one connection carries concurrent calls matched by a correlation id. Each gateway process needs its own port. Use RocketMQ when you already run a RocketMQ 5 gRPC proxy. The plugin does not speak the 4.x remoting protocol. Gateways share consumer group graft-gateway on the request topic, and each client uses its own group graft-client-<id> on the reply topic.

Release archives

Each release archive is flat and contains the plugin shared library. Third-party libraries are linked into that library. A client does not install OpenSSL, curl, zlib, the AWS SDK, the Azure SDK, or the VC++ Redistributable to load these plugins.

  • Windows. The archive is the plugin DLL only. The MSVC CRT is static (/MT). ucrtbase.dll and other Windows system libraries stay on the machine.
  • Linux and macOS. The archive is the plugin .so or .dylib only. glibc, libstdc++, libc++, and libSystem stay on the host.
  • Linux Kafka. The archive also contains libsasl2.so.2 and libsasl2.so.2.0.25. Cyrus SASL loads mechanism modules at runtime, so that library stays shared. Copy those files next to libKafkaPlugin.so.

name in the config is the library file name without the extension: SqsPlugin for SqsPlugin.dll, libSqsPlugin for libSqsPlugin.so.

Use a plugin

  1. Download the release archive for the platform, or build the plugin (see its Readme).
  2. Put gg, the hosted module, and the plugin library in one folder. For Linux Kafka, also put libsasl2.so.2 and libsasl2.so.2.0.25 from the same archive there.
  3. Start the Gateway with --config and one of the JSON files below. Verified local Docker layouts are available under communication-plugin-samples.
  4. Call the Gateway from .NET with the Hypertube SDK (see Client configuration), or open http://localhost:81/GV and install the generated package.

How the Gateway loads a plugin is described in the "Plugin server config" section of the Graftcode Gateway README.

Gateway config

The Gateway --config file is the plugin object. The calling runtime wraps that same object in configurations → package name → plugin. Linux and macOS use a lib prefix on name (libRabbitmqPlugin). Field lists are in each plugin Readme.

RabbitMQ (communication-plugins/rabbitmq/Readme.md):

{
  "name": "RabbitmqPlugin",
  "host": "localhost",
  "port": 5672,
  "queue": "myqueue",
  "user": "guest",
  "password": "guest",
  "vhost": "/",
  "rpcTimeoutMs": 30000
}

Service Bus (communication-plugins/servicebus/Readme.md):

{
  "name": "ServiceBusPlugin",
  "connectionString": "Endpoint=sb://<namespace>.servicebus.windows.net/;SharedAccessKeyName=<keyName>;SharedAccessKey=<key>",
  "queue": "myqueue",
  "replyQueue": "myqueue.reply",
  "rpcTimeoutMs": 30000
}

Kafka (communication-plugins/kafka/Readme.md):

{
  "name": "KafkaPlugin",
  "brokers": "localhost:9092",
  "requestTopic": "graft.requests",
  "replyTopic": "graft.replies",
  "groupId": "graft-gateway",
  "rpcTimeoutMs": 30000
}

Redpanda uses the same KafkaPlugin (communication-plugins/kafka/Readme.md). On Linux and macOS name is libKafkaPlugin. Callers set a groupId other than graft-gateway.

{
  "name": "KafkaPlugin",
  "brokers": "localhost:19092",
  "requestTopic": "graft.requests.netcore",
  "replyTopic": "graft.replies.netcore",
  "groupId": "graft-gateway",
  "rpcTimeoutMs": 30000
}

SQS (communication-plugins/sqs/Readme.md, LocalStack):

{
  "name": "SqsPlugin",
  "region": "us-east-1",
  "endpointOverride": "http://localhost:4566",
  "accessKeyId": "test",
  "secretAccessKey": "test",
  "requestQueueUrl": "http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/graft-requests",
  "waitTimeSeconds": 10,
  "visibilityTimeoutSeconds": 60,
  "verifySsl": false
}

Pub/Sub (communication-plugins/pubsub/Readme.md, emulator):

{
  "name": "PubSubPlugin",
  "projectId": "graftcode-local",
  "emulatorHost": "localhost:8085",
  "requestTopic": "graft-requests",
  "ackDeadlineSeconds": 60,
  "autoCreate": true,
  "verifySsl": false
}

Beanstalk (communication-plugins/beanstalk/Readme.md):

{
  "name": "BeanstalkPlugin",
  "host": "localhost",
  "port": 11300,
  "tube": "graft.requests",
  "rpcTimeoutMs": 30000
}

ActiveMQ (communication-plugins/activemq/Readme.md):

{
  "name": "ActivemqPlugin",
  "host": "localhost",
  "port": 61613,
  "queue": "graft.requests",
  "user": "admin",
  "password": "admin",
  "rpcTimeoutMs": 30000
}

Bull (communication-plugins/bull/Readme.md):

{
  "name": "BullPlugin",
  "host": "localhost",
  "port": 6379,
  "requestQueue": "graft.requests",
  "rpcTimeoutMs": 30000
}

Crossbar (communication-plugins/crossbar/Readme.md). Port 8080 is the router protocol port. The sample publishes that WebSocket on the host as 18080:

{
  "name": "CrossbarPlugin",
  "host": "localhost",
  "port": 8080,
  "realm": "realm1",
  "procedure": "graft.invoke",
  "path": "/ws",
  "rpcTimeoutMs": 30000
}

Malamute (communication-plugins/malamute/Readme.md):

{
  "name": "MalamutePlugin",
  "host": "localhost",
  "port": 9999,
  "service": "graft",
  "rpcTimeoutMs": 30000
}

NATS (communication-plugins/nats/Readme.md):

{
  "name": "NatsPlugin",
  "host": "localhost",
  "port": 4222,
  "subject": "graft.requests",
  "rpcTimeoutMs": 30000
}

NSQ (communication-plugins/nsq/Readme.md):

{
  "name": "NsqPlugin",
  "host": "localhost",
  "port": 4150,
  "requestTopic": "graft_requests",
  "rpcTimeoutMs": 30000
}

Mosquitto (communication-plugins/mosquitto/Readme.md):

{
  "name": "MosquittoPlugin",
  "host": "localhost",
  "port": 1883,
  "requestTopic": "graft/requests",
  "replyTopic": "graft/replies",
  "rpcTimeoutMs": 30000
}

Pulsar (communication-plugins/pulsar/Readme.md). The sample publishes the admin port 8080 on the host as 18081. The plugin uses binary port 6650:

{
  "name": "PulsarPlugin",
  "serviceUrl": "pulsar://localhost:6650",
  "requestTopic": "persistent://public/default/graft-requests",
  "replyTopic": "persistent://public/default/graft-replies",
  "rpcTimeoutMs": 30000
}

ZeroMQ (communication-plugins/zeromq/Readme.md). There is no broker. The sample binds 5555 and publishes the Gateway on 10320 and Graft Vision on 10420:

{
  "name": "ZeromqPlugin",
  "host": "localhost",
  "port": 5555,
  "rpcTimeoutMs": 30000
}

Aeron (communication-plugins/aeron/Readme.md). There is no broker. The sample subscribes to UDP 40123 and publishes the Gateway on 10315 and Graft Vision on 10415:

{
  "name": "AeronPlugin",
  "endpoint": "127.0.0.1:40123",
  "requestStream": 1001,
  "replyStream": 1002,
  "rpcTimeoutMs": 30000
}

Wire (communication-plugins/wire/Readme.md). There is no broker. The sample binds 5560 and publishes the Gateway on 10318 and Graft Vision on 10418:

{
  "name": "WirePlugin",
  "host": "127.0.0.1",
  "port": 5560,
  "rpcTimeoutMs": 30000
}

RocketMQ (communication-plugins/rocketmq/Readme.md). endpoint is the gRPC proxy, not the NameServer. The sample publishes that proxy on 8081 and the Gateway on 10316 and Graft Vision on 10416:

{
  "name": "RocketmqPlugin",
  "endpoint": "127.0.0.1:8081",
  "requestTopic": "graft-requests",
  "replyTopic": "graft-replies",
  "rpcTimeoutMs": 30000
}

Client configuration

A .NET client can call the gateway directly through the Hypertube SDK. The client config wraps the plugin object in configurations → package name → plugin, with no runtime or host keys; the plugin carries the transport.

using Hypertube.Netcore.Sdk;
using Hypertube.Netcore.Sdk.Configuration;

RuntimeBridge.AddConfig(ConfigPriority.User, configJsonOrPathToFile);
var rtmCtx = RuntimeBridge.InitializeRC("graft.nuget.netapp");
var result = rtmCtx.GetType("netapp.Calculator").CreateInstance()
    .InvokeInstanceMethod("Add", 1, 2).Execute().GetValue();

AddConfig accepts a JSON string, a path to a JSON file, or the name of an environment variable holding either. The key under configurations must match the name passed to InitializeRC. Load one plugin config per process.

Plugin Client config name
RabbitMQ rabbitmq/Readme.md RabbitmqPlugin
Kafka and Redpanda kafka/Readme.md KafkaPlugin
Service Bus servicebus/Readme.md ServiceBusPlugin
SQS sqs/Readme.md SqsPlugin
Pub/Sub pubsub/Readme.md PubSubPlugin
Beanstalk beanstalk/Readme.md BeanstalkPlugin
ActiveMQ activemq/Readme.md ActivemqPlugin
Bull bull/Readme.md BullPlugin
Crossbar crossbar/Readme.md CrossbarPlugin
Malamute malamute/Readme.md MalamutePlugin
NATS nats/Readme.md NatsPlugin
NSQ nsq/Readme.md NsqPlugin
Mosquitto mosquitto/Readme.md MosquittoPlugin
Pulsar pulsar/Readme.md PulsarPlugin
ZeroMQ zeromq/Readme.md ZeromqPlugin
RocketMQ rocketmq/Readme.md RocketmqPlugin

Part of the Graftcode project.