Giter VIP home page Giter VIP logo

amq-demo's Introduction

AMQ Broker/AMQ Streams Demo

Demo showing Kafka and Artemis on top of OpenShift.

3 8 2021 11 42 55 AM

Pre-req

For this demonstration, we will need:

  • OpenShift 4.8.x

AMQ Broker Demo (Artemis)

Creating AMQ Broker project

3 8 2021 10 39 05 AM
3 8 2021 10 40 04 AM

Deploying AMQ Broker Operator

3 8 2021 10 41 59 AM
3 8 2021 10 42 30 AM
3 8 2021 10 43 05 AM
3 8 2021 10 43 33 AM

Switch to developer console

3 8 2021 10 50 15 AM

We should see the container Operator

3 8 2021 10 51 07 AM

Deploying AMQ Broker

3 8 2021 10 53 25 AM
3 8 2021 10 53 50 AM
3 8 2021 10 54 09 AM
3 8 2021 11 01 15 AM
apiVersion: broker.amq.io/v2alpha4
kind: ActiveMQArtemis
metadata:
  name: amq-broker
  application: amq-broker-app
  namespace: amq-broker-demo
spec:
  deploymentPlan:
    size: 2
    persistenceEnabled: false
    requireLogin: false
    messageMigration: false
    managementRBACEnabled: true
    journalType: nio
    jolokiaAgentEnabled: false
    image: placeholder
  acceptors:
  - name: all
    protocols: all
    port: 61617
3 8 2021 11 06 46 AM

Deploying producer and consumer

Producer

Right click on topology page

3 8 2021 11 16 37 AM
3 8 2021 11 19 02 AM
3 8 2021 11 19 54 AM
3 8 2021 11 28 50 AM

We can check the logs to see if the producer app is working properly.

3 8 2021 11 31 09 AM
3 8 2021 11 32 16 AM

Consumer

Right click on topology page

3 8 2021 11 16 37 AM
3 8 2021 11 34 29 AM
3 8 2021 11 36 03 AM
3 8 2021 11 41 19 AM

We can check the logs to see if the consumer app is working properly.

3 8 2021 11 43 33 AM
3 8 2021 11 51 26 AM

Camel K Demo

Deploying Camel K Operator

3 8 2021 11 52 54 AM
3 8 2021 12 05 52 PM
3 8 2021 12 06 23 PM
3 8 2021 12 08 47 PM

Deploying Camel K integration

Create a new file AMQBrokerIntegration.java with the following content:

// camel-k: dependency=camel-activemq

import org.apache.camel.builder.RouteBuilder;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.BindToRegistry;

public class AMQBrokerIntegration extends RouteBuilder {
    @BindToRegistry
    public ActiveMQConnectionFactory registerActiveMQConnectionFactory() {
        System.out.println("ActiveMQ Listener: STARTING...");
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
        connectionFactory.setBrokerURL("tcp://ex-aao-hdls-svc:61617");
        connectionFactory.setUserName("admin");
        connectionFactory.setPassword("redhat");
        connectionFactory.setUseAsyncSend(false);
        connectionFactory.setClientID("Message Topic");
        connectionFactory.setConnectResponseTimeout(300);
        System.out.println("ActiveMQ Listener: STARTED");
        return connectionFactory;
    }

    @Override
    public void configure() throws Exception {
      from("activemq:topic:topic.prices")
        .log("body = ${body}")
        ;
    }
}

Now run it:

oc project amq-broker-demo
kamel run AMQBrokerIntegration.java --dev

We can find the link to download the kamel command line on the top right help icon.

3 8 2021 12 13 52 PM

Now we should see the logging of our camel route.

3 8 2021 12 20 04 PM
3 8 2021 12 24 10 PM

AMQ Streams Demo (Kafka)

kubectl -n amq-streams-demo run kafka-producer-topic1 -it --image=quay.io/strimzi/kafka:0.25.0-kafka-2.7.0 --rm=true --restart=Never — bin/kafka-console-producer.sh --broker-list my-cluster-kafka-bootstrap.amq-streams-demo.svc:9092 --topic my-topic

amq-demo's People

Contributors

luszczynski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.