Get Started with Pub/Sub v1.5.0+ stable

Table of Content

Get KubeMQ Token

Every installation method requires a KubeMQ token.

Please register to obtain your KubeMQ token.

Get KubeMQ CLI - kubemqctl

macOS / Linux

curl -sL https://get.kubemq.io/install | sh 
1

Windows

Option 1:

  • Download the latest kubemqctl.exe.
  • Place the file under e.g. C:\Program Files\kubemqctl\kubemqctl.exe
  • Add that directory to your system path to access it from any command prompt

Option 2:

Run in PowerShell as administrator:

New-Item -ItemType Directory 'C:\Program Files\kubemqctl'
Invoke-WebRequest https://github.com/kubemq-io/kubemqctl/releases/download/latest/kubemqctl.exe -OutFile 'C:\Program Files\kubemqctl\kubemqctl.exe'
[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine) + ';C:\Program Files\kubemqctl', [EnvironmentVariableTarget]::Machine)
$env:Path += ';C:\Program Files\kubemqctl'
1
2
3
4

Create KubeMQ Cluster

Run kubemqctl create cluster command:

kubemqctl cluster create -t <YOUR_KUBEMQ_TOKEN>
1

For Example:

kubemqctl-create-basic.gif

Connect Your KubeMQ Cluster

To be able to communicate with KubeMQ interface ports running in Kubernetes cluster, a Port Forward of KubeMQ's ports is needed.

kubemqctl has a handy command that will do it for you:

kubemqctl cluster proxy
1

Subscribe to Events Channel

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

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

Run the following kubemqctl command:

kubemqctl events rec hello-world
1

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

Publish to Event Channel

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

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

Run the following kubemqctl command:

kubemqctl events send hello-world "Hi KubeMQ"
1

Demo

Last Updated: 10/2/2019, 10:27:00 AM