services:
  rabbit:                                       
    image: rabbitmq:${RABBIT_TAG}               
    restart: always     
    ports:  
      - 5672:5672                               
      - 8081:15672                              
    environment:
      RABBITMQ_DEFAULT_USER: ${RABBIT_USERNAME} 
      RABBITMQ_DEFAULT_PASS: ${RABBIT_PASSWORD}
  
  publisher:
    build: 
      context: .
      dockerfile: ./Publisher/Dockerfile
    restart: always
    depends_on:
      - rabbit
    environment:
      RABBIT_HOST: rabbit
      RABBIT_USERNAME: ${RABBIT_USERNAME}
      RABBIT_PASSWORD: ${RABBIT_PASSWORD}
      RABBIT_EXCHANGE: 'SorterIn'

  concumer1:
    build: 
      context: .
      dockerfile: ./Consumer1/Dockerfile
    restart: always
    depends_on:
      - rabbit
      - publisher
    environment:
      RABBIT_HOST: rabbit
      RABBIT_USERNAME: ${RABBIT_USERNAME}
      RABBIT_PASSWORD: ${RABBIT_PASSWORD}
      RABBIT_EXCHANGE: 'SorterIn'
      RABBIT_QUEUE: 'SorterFirst'
      HAS_DELAY: "true"

  concumer2:
    build: 
      context: .
      dockerfile: ./Consumer1/Dockerfile
    restart: always
    depends_on:
      - rabbit
      - publisher
    environment:
      RABBIT_HOST: rabbit
      RABBIT_USERNAME: ${RABBIT_USERNAME}
      RABBIT_PASSWORD: ${RABBIT_PASSWORD}
      RABBIT_EXCHANGE: 'SorterIn'
      RABBIT_QUEUE: 'SorterSecond'
      HAS_DELAY: "false"

  concumer12:
    build: 
      context: .
      dockerfile: ./Consumer1/Dockerfile
    restart: always
    depends_on:
      - rabbit
      - publisher
    environment:
      RABBIT_HOST: rabbit
      RABBIT_USERNAME: ${RABBIT_USERNAME}
      RABBIT_PASSWORD: ${RABBIT_PASSWORD}
      RABBIT_EXCHANGE: 'SorterIn'
      RABBIT_QUEUE: 'SorterFirst'
      HAS_DELAY: "true"

  concumer13:
    build: 
      context: .
      dockerfile: ./Consumer1/Dockerfile
    restart: always
    depends_on:
      - rabbit
      - publisher
    environment:
      RABBIT_HOST: rabbit
      RABBIT_USERNAME: ${RABBIT_USERNAME}
      RABBIT_PASSWORD: ${RABBIT_PASSWORD}
      RABBIT_EXCHANGE: 'SorterIn'
      RABBIT_QUEUE: 'SorterFirst'
      HAS_DELAY: "true"
