This guide will walk through the process of setting up EnMasse and clients for sending and receiving messages.
-
A Kubernetes cluster (or Kubernetes-compatible such as OpenShift). You can use minikube if you want to try EnMasse on your laptop.
-
A user on the Kubernetes cluster with permissions to create cluster roles and install Custom Resource Definitions (CRD).
-
Download one of the releases from GitHub and unpack it.
-
Create the target namespace and deploy the installation bundle:
kubectl create namespace enmasse-infra kubectl config set-context $(kubectl config current-context) --namespace=enmasse-infra kubectl apply -f install/bundles/enmasse
-
Create the messaging infrastructure with the default configuration:
cat<<EOF | kubectl apply -f - apiVersion: enmasse.io/v1beta2 kind: MessagingInfrastructure metadata: name: myinfra namespace: enmasse-infra spec: {} EOF
This will deploy 1 router and 1 broker that are connected and can be used to serve multiple tenants on a cluster.
-
Create a namespace for the messaging application:
kubectl create namespace messaging-app
-
Create a tenant named
default
(in any namespace):cat<<EOF | kubectl apply -f - apiVersion: enmasse.io/v1beta2 kind: MessagingTenant metadata: name: default namespace: messaging-app spec: {} EOF
This will enable messaging on the
messaging-app
namespace, so that the operator will act on the creation of addresses and endpoints. NOTE: The name must bedefault
. -
Create a message queue:
cat<<EOF | kubectl apply -f - apiVersion: enmasse.io/v1beta2 kind: MessagingAddress metadata: name: myqueue namespace: messaging-app spec: queue: {} EOF
This will create a queue named
myqueue
which you can use as a destination for sending and receiving messages. -
Create an endpoint for accessing the address:
cat<<EOF | kubectl apply -f - apiVersion: enmasse.io/v1beta2 kind: MessagingEndpoint metadata: name: cluster namespace: messaging-app spec: cluster: {} protocols: ["AMQP"] EOF
This will create an endpoint that is accessible on the cluster only, using the AMQP 1.0 protocol.
-
Procedure
-
Start messaging client sending 10 messages to
myqueue
:kubectl run testsender -n messaging-app --image=quay.io/enmasse/testclient:latest -- -a amqp://messaging-app-cluster.enmasse-infra.svc:5672/myqueue -r sender -m 10
-
View client logs to confirm messages was sent:
kubectl logs testsender -n messaging-app
-
Start messaging client receiving 10 messages from
myqueue
:kubectl run testreceiver -n messaging-app --image=quay.io/enmasse/testclient:latest -- -a amqp://messaging-app-cluster.enmasse-infra.svc:5672/myqueue -r receiver -m 10
-
View client logs to confirm messages was received:
kubectl logs testreceiver -n messaging-app
For code examples on messaging clients, see EnMasse Example Clients.