0

In this docker file, if you comment out the kafka specific stuff and uncomment the rabbitmq stuff, this will work. If you don't, then you get: TransactionalId tx-0: Invalid transition attempted from state IN_TRANSACTION to state IN_TRANSACTION. In order to actually run this you'll need to got to here: https://github.com/Activiti/activiti-cloud-application. Build that, then go into the example-runtime-bundle/starter pom and add the ms sql server driver to the pom, then build the docker image from there. YAY Here's the docker compose:

version: '2'

services:

  activiti-database:
    build: ./mssql
    container_name: activiti-database
    ports:
      - 1433:1433
    volumes:
      - ./data/msqql.data:/var/opt/mssql
    environment:
      - ACCEPT_EULA=1
      - SQLCMDPASSWORD=mypasswordisbad10Times
      - SA_PASSWORD=mypasswordisbad10Times
      - FORCE_RESTORE

  nginx:
    image: nginx:latest
    container_name: nginx
    volumes:
      - ./nginx.conf/nginx.conf:/etc/nginx/nginx.conf
    ports:
      - 80:80
      - 443:443
    restart: unless-stopped

  zookeeper:
    image: docker.io/bitnami/zookeeper:3.8
    ports:
      - "2181:2181"
    volumes:
      - "./data/zookeeper.data:/bitnami"
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes

  kafka:
    image: docker.io/bitnami/kafka:3.4
    container_name: kafka
    ports:
      - "9092:9092"
      - "9093:9093"
    volumes:
      - "./data/kafka.data:/bitnami"
    environment:
      - KAFKA_BROKER_ID=1
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CLIENT:PLAINTEXT,EXTERNAL:PLAINTEXT
      - KAFKA_CFG_LISTENERS=CLIENT://kafka:9092,EXTERNAL://:9093
      - KAFKA_CFG_ADVERTISED_LISTENERS=CLIENT://kafka:9092,EXTERNAL://kafka:9093
      - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT
    depends_on:
      - zookeeper

#  rabbitmq:
#    container_name: rabbitmq
#    image: rabbitmq
#    ports:
#      - 5672:5672
#      - 15672:15672
#      - 61613:61613
#    volumes:
#      - ./rabbitmq-configuration/enabled_plugins:/etc/rabbitmq/enabled_plugins
##      - ./data/rabbitmq.data:rabbitmq-data
#    restart: unless-stopped

  keycloak:
    container_name: keycloak
    image: activiti/activiti-keycloak
    volumes:
      - ./keycloak-configuration/activiti-realm.json:/opt/jboss/keycloak/activiti-realm.json
    restart: unless-stopped
    depends_on:
      - nginx

  example-runtime-bundle:
    container_name: example-runtime-bundle
#    image: activiti/example-runtime-bundle:${VERSION}
#    image: jbarrowsenquizit/runtime-bundle-core:7.9.0-SNAPSHOT
#    image: activiti-demo-guide2:0.0.1-SNAPSHOT
#    image: ttc-rb-english-compaign:latest # this won't work unless I actually write the kafka
    image: runtime-bundle-override:latest
    environment:
      # JAVA_OPTS: "-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -noverify"
      ACTIVITI_CLOUD_MESSAGING_BROKER: kafka
      ACT_KEYCLOAK_URL: "http://${DOCKER_IP}/auth"
      KAFKA_BOOTSTRAP_SERVERS: "kafka:9093"
#      SPRING_RABBITMQ_HOST: "rabbitmq"
      SERVER_SERVLET_CONTEXT_PATH: /rb
      SPRING_DATASOURCE_PASSWORD: mypasswordisbad10Times
      SPRING_DATASOURCE_URL: jdbc:sqlserver://activiti-database:1433;database=activiti;trustServerCertificate=true
      SPRING_DATASOURCE_USERNAME: sa
      SPRING_JMX_ENABLED: "false"
      SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.SQLServer2008Dialect
      SPRING_JPA_GENERATE_DDL: "true"
      SPRING_JPA_HIBERNATE_DDL_AUTO: UPDATE
      SPRING_KAFKA_BOOTSTRAP_SERVERS: "kafka:9093"
      SPRING_KAFKA_PRODUCER_ACKS: all
      SPRING_KAFKA_CONSUMER_ENABLE-AUTO-COMMIT: true
      SPRING_KAFKA_CONSUMER_ISOLATION-LEVEL: read_committed
      SPRING_KAFKA_CONSUMER_AUTO-OFFSET-RESET: earliest
    restart: unless-stopped
    depends_on:
      - nginx
      - keycloak
      - kafka
#      - rabbitmq
      - activiti-database

What's wrong with my config, that I'm getting the error I mention above in Kafka, and not RabbitMQ?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Jim Barrows
  • 3,634
  • 1
  • 25
  • 36
  • What exactly is your question? If you have issues with bitnami kafka container, then use a different one – OneCricketeer Apr 14 '23 at 22:37
  • You're getting errors because you have put `KAFKA_CFG_LISTENERS` and `KAFKA_CFG_ADVERTISED_LISTENERS` more than once, and so it is simply configured wrong. Please see answer at https://stackoverflow.com/questions/51630260/connect-to-kafka-running-in-docker – OneCricketeer Apr 14 '23 at 22:39
  • Regarding Helm - https://strimzi.io – OneCricketeer Apr 14 '23 at 22:39
  • "Why don't I get error with RabbitMQ" - Because your error is specific to kafka api? And you're using a completely different function / config / connection? – OneCricketeer Apr 17 '23 at 13:26

0 Answers0