Get Started with Pub/Sub v1.5.0+ stable

Table of Content

Deploy a KubeMQ

To start using KubeMQ with Pub/Sub, we first need to run a KubeMQ docker container either locally or on a remote node.

You can select one of the methods below:

  • kubernetes
  • docker
  • helm
  • docker-compose

Execute the following command:

kubectl apply -f https://get.kubemq.io/deploy?token="YOUR_KUBEMQ_TOKEN"
1

For Example:

get_started_kubernetes.gif

Verify Deployment

Browse to KubeMQ's API end-point with GET request to /health path and get a json response like below:

For Example:

curl --location --request GET "http://localhost:8080/health" --header "Content-Type: application/json"
1

We will get this:

verify_deploy.gif

PROXY

If KubeMQ fails to load, probably there is a proxy server which prevents the validation of KubeMQ token. To fix this, you can add -e KUBEMQ_PROXY="your-proxy-url" as an environment variable.

Next Steps

Now that you have KubeMQ installed and running, we will do the following steps:

  1. Subscribe a consumer to hello-world channel
  2. Publish "Hi KubeMQ" message in the channel
  3. Display the received message in the console.

get_started_pub_sub.gif

As shown in the following diagram:

image info

Subscribe to a Channel

A consumer can subscribe to the "hello-world" channel with one of the following methods.

  • kubetools
  • cURL
  • .Net
  • Java
  • Go
  • Python
  • Node
  • PHP
  • Ruby
  • jQuery

Run the following Kubetools command:

kubetools pubsub rec events hello-world
1

When connected, a stream of events messages will be shown in the console.

Publish to a Channel

After you have subscribed to a hello-world channel, you can send your message to it.

  • kubetools
  • cURL
  • .Net
  • Java
  • Go
  • Python
  • Node
  • PHP
  • Ruby
  • jQuery

Run the following Kubetools command:

kubetools pubsub send events hello-world "Hi KubeMQ"
1

Kubetools

Kubetools is KubeMQ Command-Line-Interface tool.

Installation instructions here.

Last Updated: 8/21/2019, 6:37:49 PM