ewolff / microservice-kafka

Demo to show how Apache Kafka can be used for communication between microservices
Apache License 2.0
585 stars 302 forks source link

Oders are not processed #2

Closed tobiasheine closed 7 years ago

tobiasheine commented 7 years ago

When I create an order it takes quite some time before I get the success message, but it seems the messaging is broken since I don't see any invoice or shipment being created.

If there are any logs I could provide I'd need some help to locate them since I am a newby when it comes to web/backend development.

screen shot 2017-08-27 at 13 16 41 screen shot 2017-08-27 at 13 16 49 screen shot 2017-08-27 at 13 16 54
ewolff commented 7 years ago

Thanks. You can get a list of all running docker containers with docker ps:

CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                                                NAMES
857aadf7c40e        mskafka_apache                 "/bin/sh -c 'apach..."   9 seconds ago       Up 7 seconds        0.0.0.0:8080->80/tcp                                 mskafka_apache_1
9220cef4f9c0        mskafka_invoicing              "/bin/sh -c '/usr/..."   11 seconds ago      Up 8 seconds        8080/tcp                                             mskafka_invoicing_1
989c84b240a2        mskafka_shipping               "/bin/sh -c '/usr/..."   11 seconds ago      Up 8 seconds        8080/tcp                                             mskafka_shipping_1
aff85f17793f        mskafka_order                  "/bin/sh -c '/usr/..."   11 seconds ago      Up 8 seconds        8080/tcp                                             mskafka_order_1
b1ea3311f031        wurstmeister/kafka:0.10.2.1    "start-kafka.sh"         13 seconds ago      Up 11 seconds                                                            mskafka_kafka_1
c83247820e4d        mskafka_postgres               "docker-entrypoint..."   14 seconds ago      Up 12 seconds       5432/tcp                                             mskafka_postgres_1
a397c26c1947        wurstmeister/zookeeper:3.4.6   "/bin/sh -c '/usr/..."   14 seconds ago      Up 12 seconds       22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp   mskafka_zookeeper_1

You can see the logs with docker logs <docker-container-name> e.g. docker logs mskafka_zookeeper_1

tobiasheine commented 7 years ago

Great, so apparently the order message cannot be sent to the topic due to a timeout.

Exception thrown when sending a message with key='7created' and payload='com.ewolff.microservice.order.logic.Order@48f9766a[id=7,customer=com.ewolff.microservice.order.custo...' to topic order:

org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.
ewolff commented 7 years ago

Thanks. Is the Kafka container running? What does the log of the Kafka container say?

ewolff commented 7 years ago

I suspect that Docker does not have enough RAM. If you are running a local Docker installation on Windows or macOS, go to Preferences -> Advanced and make sure memory is set to 4 GB. If you are using Docker Machine use docker-machine create --virtualbox-memory "4096" --driver virtualbox dev.

ewolff commented 7 years ago

This is actually really a bug. The problem is that the configuration was messed up and therefore the Kafka server was not really accessed. Thanks for pointing this out!