🔧 Wired the kafka producer back up

This commit is contained in:
2025-01-27 19:28:40 -05:00
parent cd9ea85b80
commit 36f08212a0

View File

@@ -27,9 +27,9 @@ export default class ComicProcessorService extends Service {
// @ts-ignore: schema parameter is required by Service constructor // @ts-ignore: schema parameter is required by Service constructor
constructor( constructor(
public broker: ServiceBroker, public broker: ServiceBroker,
schema: ServiceSchema<{}> = { name: "comicProcessor" }, schema: ServiceSchema<object> = { name: "comicProcessor" },
) { ) {
super(broker); super(broker, schema);
this.parseServiceSchema({ this.parseServiceSchema({
name: "comicProcessor", name: "comicProcessor",
methods: { methods: {
@@ -158,12 +158,12 @@ export default class ComicProcessorService extends Service {
/* /*
Match and rank Match and rank
*/ */
const result = await this.rankSearchResults( const finalResult = await this.rankSearchResults(
this.airDCPPSearchResults, this.airDCPPSearchResults,
query, query,
); );
console.log(JSON.stringify(result, null, 4)); console.log("Final result:");
console.log("majori"); console.log(JSON.stringify(finalResult, null, 4));
/* /*
Kafka messages need to be in a format that can be serialized to JSON, Kafka messages need to be in a format that can be serialized to JSON,
and a Map is not directly serializable in a way that retains its structure, and a Map is not directly serializable in a way that retains its structure,
@@ -173,7 +173,7 @@ export default class ComicProcessorService extends Service {
topic: "comic-search-results", topic: "comic-search-results",
messages: [ messages: [
{ {
value: JSON.stringify(result), value: JSON.stringify(finalResult),
}, },
], ],
}); });
@@ -186,7 +186,7 @@ export default class ComicProcessorService extends Service {
args: [ args: [
{ {
query, query,
result, finalResult,
}, },
], ],
}); });