Skip to content

Commit

Permalink
Merge pull request #1226 from moleculerjs/kafkajs
Browse files Browse the repository at this point in the history
Using `kafkajs` library in Kafka transporter
  • Loading branch information
icebob authored Jul 16, 2023
2 parents da81b90 + 43af200 commit f11f772
Show file tree
Hide file tree
Showing 9 changed files with 406 additions and 1,560 deletions.
10 changes: 5 additions & 5 deletions dev/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const broker = new ServiceBroker({
}
},
*/
//transporter: "kafka://192.168.0.181:9092",
transporter: "kafka://127.0.0.1:9093",
//transporter: "amqp://192.168.0.181:5672",
transporter: "NATS",
//transporter: "NATS",
//serializer: "MsgPack",
//requestTimeout: 1000,

Expand All @@ -34,7 +34,7 @@ const broker = new ServiceBroker({
//discoverer: "Etcd3"
},

cacher: true,
//cacher: true,

metrics: {
enabled: false,
Expand Down Expand Up @@ -80,8 +80,8 @@ const broker = new ServiceBroker({
logger: console,
logLevel: "info",
middlewares: [
//Middlewares.Transmit.Encryption("moleculer", "aes-256-cbc"),
//Middlewares.Transmit.Compression(),
// Middlewares.Transmit.Encryption("moleculer", "aes-256-cbc"),
// Middlewares.Transmit.Compression()
//Middlewares.Debugging.TransitLogger({ logPacketData: false, /*folder: null, colors: { send: "magenta", receive: "blue"}*/ }),
//Middlewares.Debugging.ActionLogger({ logParams: true, logResponse: true, /*folder: null, colors: { send: "magenta", receive: "blue"}*/ }),
//require("./RedisHeartbeat")
Expand Down
8 changes: 4 additions & 4 deletions dev/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ const broker = new ServiceBroker({
}
},
*/
//transporter: "kafka://localhost:9093",
transporter: "kafka://localhost:9093",
//transporter: "amqp://192.168.0.181:5672",
//transporter: "AMQP10",
transporter: "NATS",
//transporter: "NATS",
//serializer: "MsgPack",

//disableBalancer: true,
Expand Down Expand Up @@ -63,8 +63,8 @@ const broker = new ServiceBroker({
logLevel: "info",

middlewares: [
//Middlewares.Transmit.Encryption("moleculer", "aes-256-cbc"),
//Middlewares.Transmit.Compression(),
// Middlewares.Transmit.Encryption("moleculer", "aes-256-cbc"),
// Middlewares.Transmit.Compression()
//Middlewares.Debugging.TransitLogger({ logPacketData: false, /*folder: null, colors: { send: "magenta", receive: "blue"}*/ }),
//Middlewares.Debugging.ActionLogger({ logPacketData: false, /*folder: null, colors: { send: "magenta", receive: "blue"}*/ }),
//require("./RedisHeartbeat")
Expand Down
1 change: 1 addition & 0 deletions examples/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
"no-var": ["warn"],
"no-console": ["off"],
"no-unused-vars": ["off"],
"no-mixed-spaces-and-tabs": ["off"],
"security/detect-possible-timing-attacks": ["off"]
}
};
13 changes: 7 additions & 6 deletions examples/opentelemetry/opentelemetry.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ module.exports = {
delete ctx.meta.$otel;
}

const actionObj = ctx.action
? {
name: ctx.action.name,
rawName: ctx.action.rawName
}
: null;
let tags = {
callingLevel: ctx.level,
action: ctx.action
? {
name: ctx.action.name,
rawName: ctx.action.rawName
}
: null,
action: actionObj,
remoteCall: ctx.nodeID !== ctx.broker.nodeID,
callerNodeID: ctx.nodeID,
nodeID: ctx.broker.nodeID,
Expand Down
Loading

0 comments on commit f11f772

Please sign in to comment.