fluidex/dingir-exchange

fix monitor_kafka_message.js

Closed this issue · 1 comments

fix monitor_kafka_message.js

our exchange workflow

default PersistPolicy::ToMessage

so

controller writes to kafka

    fn push_order_message(&mut self, order: &OrderMessage) {
        let message = serde_json::to_string(&order).unwrap();
        self.push_message_and_topic(message, ORDERS_TOPIC)
    }
    fn push_trade_message(&mut self, trade: &Trade) {
        let message = serde_json::to_string(&trade).unwrap();
        self.push_message_and_topic(message, TRADES_TOPIC)
    }
    fn push_balance_message(&mut self, balance: &BalanceMessage) {
        let message = serde_json::to_string(&balance).unwrap();
        self.push_message_and_topic(message, BALANCES_TOPIC)
    }
    fn push_user_message(&mut self, user: &UserMessage) {
        let message = serde_json::to_string(&user).unwrap();
        self.push_message_and_topic(message, USER_TOPIC)
    }

persistor reads from kafka and then write to db


but when I was running example/js/depoist.jsand example/js/trade.js, db data doesn't change.

when I was trying to debug using dingir-exchange/examples/js/monitor_kafka_message.js, I find that I cannot run it.

expected behavior:

  • fix monitor_kafka_message.js
  • monitor_kafka_message.js can monitor messages
  • db changes after for update_balance & put_order (and also trade if applicable)