Skip to content

Commit

Permalink
Binary message support (#87)
Browse files Browse the repository at this point in the history
*  protobuf message format
* server acks
  • Loading branch information
ramank775 authored Sep 4, 2022
1 parent 1282020 commit 1b01460
Show file tree
Hide file tree
Showing 36 changed files with 2,686 additions and 1,235 deletions.
18 changes: 12 additions & 6 deletions .env.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ TOPIC_OFFLINE_MESSAGE=offline-message
TOPIC_NEW_GROUP_MS=new-group-message
TOPIC_NEW_LOGIN=new-login
TOPIC_SYSTEM_MESSAGE=system-message
TOPIC_CLIENT_ACK_MESSAGE=client-ack

# CREATE TOPIC FOR NAMED SERVICE
PERSISTENCE_MESSAGE_MS_INITIAL=persistence-message

# EVENT STORE
EVENT_STORE=nats

# KAKFA CLIENT ID
GATEWAY_CLIENT_ID=gateway-1
MESSAGE_DELIVERY_CLIENT_ID=message-delivery-1
Expand All @@ -26,17 +30,13 @@ KAFKA_SECURITY_PROTOCOL=
KAFKA_SASL_USERNAME=
KAFKA_SASL_PASSWORD=

# KAFKA CONSUMER GROUP
# EVENT STORE CONSUMER GROUP
CONSUMER_GROUP_MESSAGE_ROUTER=message-router
CONSUMER_GROUP_MESSAGE_DELIVERY=message-delivery
CONSUMER_GROUP_GATEWAY=gateway
CONSUMER_GROUP_GROUP_MESSAGE_ROUTER=group-message-router
CONSUMER_GROUP_NOTIFICATION=notification-ms

# GROUP MS OPTIONS
GROUP_MS_JSON_HOST=127.0.0.1
GROUP_MS_JSON_PORT=8002

# MONGO URL
MONGO_URL=mongodb://localhost:27017/chat
MONGO_USER=
Expand All @@ -45,8 +45,11 @@ MONGO_PASSWORD=
# Redis
REDIS_ENDPOINT=localhost:6379

# Push Notification
PN_SERVICE=mock

# Firebase
FIREBASE_PROJECT_ID=vartalap-bef91
FIREBASE_PROJECT_ID=vartalap-dev
FIREBASE_ADMIN_CRED_JSON_PATH=./deployment/config/firebase/service.json

# s3
Expand All @@ -59,3 +62,6 @@ SERVICE_DISCOVERY_PATH=./deployment/config/discovery_service/services.json

# NATS
NATS_SERVER_LIST=nats://127.0.0.1:4222

# AUTH Provider
AUTH_PROVIDER=mock
205 changes: 41 additions & 164 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,50 @@
{
"type": "node",
"request": "launch",
"name": "Launch Gateway MS - Kafka",
"name": "Launch Gateway MS",
"program": "${workspaceFolder}/services/connection-gateway/gateway.js",
"args": [
"--app-name=ws-gateway-1",
"--debug",
"--gateway-name=gateway-1",
"--event-store=kafka",
"--kafka-client-id=gateway-1",
"--event-store=${EVENT_STORE}",
"--user-connection-state-topic=${TOPIC_USER_CONNECTION_STATE}",
"--client-ack-topic=${TOPIC_CLIENT_ACK_MESSAGE}",
"--new-message-topic=${TOPIC_NEW_MESSAGE}",
"--kafka-client-id=gateway-1",
"--kafka-broker-list=${BROKER_LIST}",
"--kafka-security-protocol=${KAFKA_SECURITY_PROTOCOL}",
"--kafka-sasl-username=${KAFKA_SASL_USERNAME}",
"--kafka-sasl-password=${KAFKA_SASL_PASSWORD}"
"--kafka-sasl-password=${KAFKA_SASL_PASSWORD}",
"--nats-server-list=${NATS_SERVER_LIST}"
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch Message Delivery MS - Kafka",
"name": "Launch Message Delivery MS",
"program": "${workspaceFolder}/services/message-delivery/message-delivery-ms.js",
"args": [
"--app-name=message-delivery",
"--debug",
"--mongo-url=${MONGO_URL}",
"--event-store=kafka",
"--kafka-client-id=message-delivery-1",
"--kafka-consumer-group=${CONSUMER_GROUP_MESSAGE_DELIVERY}",
"--event-store=${EVENT_STORE}",
"--user-connection-state-topic=${TOPIC_USER_CONNECTION_STATE}",
"--send-message-topic=${TOPIC_SEND_MESSAGE}",
"--system-message-topic=${TOPIC_SYSTEM_MESSAGE}",
"--offline-message-topic=${TOPIC_OFFLINE_MESSAGE}",
"--client-ack-topic=${TOPIC_CLIENT_ACK_MESSAGE}",
"--service-discovery-path=${SERVICE_DISCOVERY_PATH}",
"--kafka-client-id=message-delivery-1",
"--kafka-consumer-group=${CONSUMER_GROUP_MESSAGE_DELIVERY}",
"--kafka-broker-list=${BROKER_LIST}",
"--kafka-security-protocol=${KAFKA_SECURITY_PROTOCOL}",
"--kafka-sasl-username=${KAFKA_SASL_USERNAME}",
"--kafka-sasl-password=${KAFKA_SASL_PASSWORD}",
"--nats-server-list=${NATS_SERVER_LIST}",
"--nats-consumer-group=${CONSUMER_GROUP_MESSAGE_DELIVERY}",
"--cache-type=redis",
"--redis-endpoint=127.0.0.1:6379"
],
Expand All @@ -54,81 +59,87 @@
{
"type": "node",
"request": "launch",
"name": "Launch Message Router MS - Kafka",
"name": "Launch Message Router MS",
"program": "${workspaceFolder}/services/message-router-ms/message-router-ms.js",
"args": [
"--app-name=message-router-1",
"--debug",
"--event-store=kafka",
"--kafka-client-id=message-router-1",
"--kafka-consumer-group=${CONSUMER_GROUP_MESSAGE_ROUTER}",
"--event-store=${EVENT_STORE}",
"--send-message-topic=${TOPIC_SEND_MESSAGE}",
"--new-message-topic=${TOPIC_NEW_MESSAGE}",
"--system-message-topic=${TOPIC_SYSTEM_MESSAGE}",
"--group-message-topic=${TOPIC_NEW_GROUP_MS}",
"--kafka-broker-list=${BROKER_LIST}",
"--kafka-client-id=message-router-1",
"--kafka-consumer-group=${CONSUMER_GROUP_MESSAGE_ROUTER}",
"--kafka-security-protocol=${KAFKA_SECURITY_PROTOCOL}",
"--kafka-sasl-username=${KAFKA_SASL_USERNAME}",
"--kafka-sasl-password=${KAFKA_SASL_PASSWORD}"
"--kafka-sasl-password=${KAFKA_SASL_PASSWORD}",
"--nats-server-list=${NATS_SERVER_LIST}",
"--nats-consumer-group=${CONSUMER_GROUP_MESSAGE_ROUTER}",
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch profile MS - Kafka",
"name": "Launch profile MS",
"program": "${workspaceFolder}/services/profile-ms/profile-ms.js",
"args": [
"--app-name=profile-ms-1",
"--debug",
"--port=4000",
"--auth-provider=mock",
"--auth-provider=${AUTH_PROVIDER}",
"--mongo-url=${MONGO_URL}",
"--firebase-project-id=${FIREBASE_PROJECT_ID}",
"--event-store=kafka",
"--event-store=${EVENT_STORE}",
"--kafka-broker-list=${BROKER_LIST}",
"--kafka-security-protocol=${KAFKA_SECURITY_PROTOCOL}",
"--kafka-sasl-username=${KAFKA_SASL_USERNAME}",
"--kafka-sasl-password=${KAFKA_SASL_PASSWORD}",
"--new-login-topic=${TOPIC_NEW_LOGIN}"
"--new-login-topic=${TOPIC_NEW_LOGIN}",
"--nats-server-list=${NATS_SERVER_LIST}",
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch group MS - Kafka",
"name": "Launch group MS",
"program": "${workspaceFolder}/services/group-ms/group-ms.js",
"args": [
"--app-name=group-ms-1",
"--debug",
"--port=4002",
"--mongo-url=mongodb://localhost:27017/chat",
"--event-store=kafka",
"--event-store=${EVENT_STORE}",
"--kafka-client-id=group-1",
"--kafka-broker-list=${BROKER_LIST}",
"--new-group-message-topic=${TOPIC_NEW_GROUP_MS}"
"--system-message-topic=${TOPIC_SYSTEM_MESSAGE}",
"--nats-server-list=${NATS_SERVER_LIST}",
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch Group Message Router MS - Kafka",
"name": "Launch Group Message Router MS",
"program": "${workspaceFolder}/services/group-ms/group-message-router-ms.js",
"args": [
"--app-name=group-message-router-1",
"--debug",
"--event-store=kafka",
"--kafka-client-id=group-message-router-1",
"--event-store=${EVENT_STORE}",
"--send-message-topic=${TOPIC_SEND_MESSAGE}",
"--kafka-consumer-group=${CONSUMER_GROUP_GROUP_MESSAGE_ROUTER}",
"--new-group-message-topic=${TOPIC_NEW_GROUP_MS}",
"--system-message-topic=${TOPIC_SYSTEM_MESSAGE}",
"--kafka-broker-list=${BROKER_LIST}",
"--kafka-client-id=group-message-router-1",
"--kafka-consumer-group=${CONSUMER_GROUP_GROUP_MESSAGE_ROUTER}",
"--nats-server-list=${NATS_SERVER_LIST}",
"--nats-consumer-group=${CONSUMER_GROUP_GROUP_MESSAGE_ROUTER}",
"--mongo-url=${MONGO_URL}",
"--persistence-message-topic=${TOPIC_DB_MESSAGE}"
],
Expand All @@ -138,20 +149,22 @@
{
"type": "node",
"request": "launch",
"name": "Launch notification MS - Kafka",
"name": "Launch notification MS",
"program": "${workspaceFolder}/services/notification-ms/notification-ms.js",
"args": [
"--app-name=notification-ms-1",
"--debug",
"--mongo-url=${MONGO_URL}",
"--pn-service=mock",
"--pn-service=${PN_SERVICE}",
"--firebase-admin-credential-json-path=${workspaceFolder}/${FIREBASE_ADMIN_CRED_JSON_PATH}",
"--event-store=kafka",
"--event-store=${EVENT_STORE}",
"--kafka-broker-list=${BROKER_LIST}",
"--kafka-security-protocol=${KAFKA_SECURITY_PROTOCOL}",
"--kafka-sasl-username=${KAFKA_SASL_USERNAME}",
"--kafka-sasl-password=${KAFKA_SASL_PASSWORD}",
"--kafka-consumer-group=notification-ms",
"--nats-server-list=${NATS_SERVER_LIST}",
"--nats-consumer-group=notification-ms",
"--new-login-topic=${TOPIC_NEW_LOGIN}",
"--offline-message-topic=${TOPIC_OFFLINE_MESSAGE}",
"--db-app-initial=${PERSISTENCE_MESSAGE_MS_INITIAL}"
Expand All @@ -162,7 +175,7 @@
{
"type": "node",
"request": "launch",
"name": "Launch file MS - Common",
"name": "Launch file MS",
"program": "${workspaceFolder}/services/file-ms/file-ms.js",
"args": [
"--app-name=file-ms-1",
Expand All @@ -179,141 +192,5 @@
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch Gateway MS - Nats",
"program": "${workspaceFolder}/services/connection-gateway/gateway.js",
"args": [
"--app-name=ws-gateway-1",
"--debug",
"--gateway-name=gateway-1",
"--event-store=nats",
"--user-connection-state-topic=${TOPIC_USER_CONNECTION_STATE}",
"--new-message-topic=${TOPIC_NEW_MESSAGE}",
"--nats-server-list=${NATS_SERVER_LIST}"
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true,
},
{
"type": "node",
"request": "launch",
"name": "Launch Message Delivery MS - NATS",
"program": "${workspaceFolder}/services/message-delivery/message-delivery-ms.js",
"args": [
"--app-name=message-delivery",
"--debug",
"--mongo-url=${MONGO_URL}",
"--event-store=nats",
"--user-connection-state-topic=${TOPIC_USER_CONNECTION_STATE}",
"--send-message-topic=${TOPIC_SEND_MESSAGE}",
"--system-message-topic=${TOPIC_SYSTEM_MESSAGE}",
"--offline-message-topic=${TOPIC_OFFLINE_MESSAGE}",
"--service-discovery-path=${SERVICE_DISCOVERY_PATH}",
"--nats-server-list=${NATS_SERVER_LIST}",
"--nats-consumer-group=${CONSUMER_GROUP_MESSAGE_DELIVERY}",
"--cache-type=redis",
"--redis-endpoint=127.0.0.1:6379"
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch Message Router MS - NATS",
"program": "${workspaceFolder}/services/message-router-ms/message-router-ms.js",
"args": [
"--app-name=message-router-1",
"--debug",
"--event-store=nats",
"--send-message-topic=${TOPIC_SEND_MESSAGE}",
"--new-message-topic=${TOPIC_NEW_MESSAGE}",
"--system-message-topic=${TOPIC_SYSTEM_MESSAGE}",
"--group-message-topic=${TOPIC_NEW_GROUP_MS}",
"--nats-server-list=${NATS_SERVER_LIST}",
"--nats-consumer-group=${CONSUMER_GROUP_MESSAGE_ROUTER}",
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch profile MS - NATS",
"program": "${workspaceFolder}/services/profile-ms/profile-ms.js",
"args": [
"--app-name=profile-ms-1",
"--debug",
"--port=4000",
"--auth-provider=mock",
"--mongo-url=${MONGO_URL}",
"--firebase-project-id=${FIREBASE_PROJECT_ID}",
"--event-store=nats",
"--new-login-topic=${TOPIC_NEW_LOGIN}",
"--nats-server-list=${NATS_SERVER_LIST}",
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch group MS - NATS",
"program": "${workspaceFolder}/services/group-ms/group-ms.js",
"args": [
"--app-name=group-ms-1",
"--debug",
"--port=4002",
"--mongo-url=mongodb://localhost:27017/chat",
"--event-store=nats",
"--new-group-message-topic=${TOPIC_NEW_GROUP_MS}",
"--nats-server-list=${NATS_SERVER_LIST}",
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch Group Message Router MS - NATS",
"program": "${workspaceFolder}/services/group-ms/group-message-router-ms.js",
"args": [
"--app-name=group-message-router-1",
"--debug",
"--event-store=nats",
"--send-message-topic=${TOPIC_SEND_MESSAGE}",
"--new-group-message-topic=${TOPIC_NEW_GROUP_MS}",
"--system-message-topic=${TOPIC_SYSTEM_MESSAGE}",
"--persistence-message-topic=${TOPIC_DB_MESSAGE}",
"--nats-server-list=${NATS_SERVER_LIST}",
"--nats-consumer-group=${CONSUMER_GROUP_GROUP_MESSAGE_ROUTER}",
"--mongo-url=${MONGO_URL}",
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Launch notification MS - NATS",
"program": "${workspaceFolder}/services/notification-ms/notification-ms.js",
"args": [
"--app-name=notification-ms-1",
"--debug",
"--mongo-url=${MONGO_URL}",
"--pn-service=mock",
"--firebase-admin-credential-json-path=${workspaceFolder}/${FIREBASE_ADMIN_CRED_JSON_PATH}",
"--event-store=nats",
"--nats-server-list=${NATS_SERVER_LIST}",
"--nats-consumer-group=notification-ms",
"--new-login-topic=${TOPIC_NEW_LOGIN}",
"--offline-message-topic=${TOPIC_OFFLINE_MESSAGE}",
"--db-app-initial=${PERSISTENCE_MESSAGE_MS_INITIAL}"
],
"envFile": "${workspaceFolder}/.env",
"autoAttachChildProcesses": true
},
]
}
Loading

0 comments on commit 1b01460

Please sign in to comment.