Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to integrate Mosquitto broker in Dapr example #1040

Open
Soujanya459 opened this issue Jun 25, 2024 · 1 comment
Open

Trying to integrate Mosquitto broker in Dapr example #1040

Soujanya459 opened this issue Jun 25, 2024 · 1 comment

Comments

@Soujanya459
Copy link

Hi I'm trying to integrate the Mosuitto broker in Dapr example instead of Redis.. I'm creating services in docker container.
I have modified docker-compose.yml and mosquitto.cnf and components/pubsub.yml as below..
Why Dapr side-car is not starting for the service-checkout.. IT shows there is error while associating pubsub.yml file..
can you please let me know what does this below error mean? what can I modify ?

checkout-dapr-1 | time="2024-06-25T06:31:50.829991065Z" level=fatal msg="Fatal error from runtime: process component filetransferpubsub error: [INIT_COMPONENT_FAIL URE]: initialization error occurred for filetransferpubsub (pubsub.mqtt3/v1): init timeout for component filetransferpubsub (pubsub.mqtt/v1) exceeded after 5s" app_id=checkout-dapr instance=7bb69d830a3c scope=dapr.runtime type=log ver=edge

docker-compose.yml

checkout:
    build: ./checkout
    depends_on:
      - mqtt-broker
    networks:
      - hello-dapr
checkout-dapr:
    image: "daprio/daprd:edge"
    command: ["./daprd",
              "-app-id", "checkout-dapr",
              "-components-path", "/components"]
    volumes:
      - "./components/:/components"
    network_mode: "service:checkout"
 
mqtt-broker:
    image: "eclipse-mosquitto"
    ports:
      - "50007:50007"
    volumes:
      - "./mqtt/mosquitto.conf:/mosquitto/config/mosquitto.conf"
    networks:
      - hello-dapr

pubsub.yml

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: filetransferpubsub
spec:
type: pubsub.mqtt
version: v1
metadata:
 - name: url
   value: "tcp://mqtt-broker:50007"
 - name: cleanSession
   value: "false"
 - name: consumerID
   value: "channel1"
 - name: qos
   value: "1"

mosquitto.conf

listener 50007
require_certificate false
@paulyuk
Copy link
Contributor

paulyuk commented Jul 29, 2024

Hey @Soujanya459, I think that is telling you that the checkout-dapr sidecar is timing out before MQTT component is ready. If you want to have the docker compose file up start everything, you might need the checkout-dapr container to depend on the health of the mqtt container because this is all ordering/timing dependent.

A simpler idea is to just docker compose up the mqtt container first. Then as a separate process either docker compose up (another compose.yaml file) your checkout and checkout-dapr containers. You could also use multi app run (dapr.yaml) to start your checkout app, and do that separate from the docker compose up of mqtt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants