Version 2.0 Features and Roadmap #227
Replies: 2 comments 2 replies
-
Regarding RabbitMQI've started using this library recently and I think it is pretty decent, though it lacks some functionality.
Regarding those two points, some potential API change may look like this: public publish(
exchange: string,
routingKey: string,
message: any,
options?: amqplib.Options.Publish
)
public request<ExpectedReturnType>(
exchange: string,
routingKey: string,
message: any,
options?: amqplib.Options.Publish & {correlationId?: string; timeout?: number} //simplification
) Instead of this: public publish(
exchange: string,
routingKey: string,
message: any,
options?: amqplib.Options.Publish
)
public request<ExpectedReturnType>({
exchange: string;
routingKey: string;
correlationId?: string;
timeout?: number;
payload?: any;
})
@RabbitRPC({
exchange: "exchange",
routingKey: "routing.key",
queue: "test.queue",
})
async doStuff(data: Stuff): Promise<{message:any, options: amqp.Options}> {
const stuff = ...
return {
message: stuff:
options: { ... }
}
} Or we could allow @RabbitRPC to be provided with additional function, that would postprocess outcoming message (and why not the other one to preprocess incoming message). This might look sth like that: // Function may take exchange name, routingkey, queue name and message content in order to calculate the options dynamically
const postProcessFoo = (exchange: string, routingKey: string, queue: string, message: any): Options => ({
contentType: "application/json"
...
})
@RabbitRPC({
exchange: "exchange",
routingKey: "routing.key",
queue: "test.queue",
postProcessor: postProcessFoo
})
async doStuff(data: Stuff): Promise<{message:any, options: amqp.Options}> {
const stuff = ...
return stuff;
} I hope this makes sense. |
Beta Was this translation helpful? Give feedback.
-
I do think that allowing custom pipes for the data on RPC is really important for data validation, you could run class-validator by default but it does make sense to have it |
Beta Was this translation helpful? Give feedback.
-
There are recurring requests from the community around things like better error handling, retry logic, custom message parsing and validation.
Many of these issues can be addressed together by deciding to make some breaking changes to the API surface instead of trying to tack on non-breaking changes to the current design.
The goal of this discussion is to facilitate brainstorming and consolidated feature requests for what the next version of the library should be capable of.
Any example interfaces/API suggestions are welcome.
Beta Was this translation helpful? Give feedback.
All reactions