A simple microservice to consume the github webhook event

Hi, I have written a microservice to consume the GitHub webhook event in

It is a simple gateway service that will consume any Github event sent from Github and forward it to a back-end service. The backend service is not of the interested here.

The service will have two event loops: one is to accept the GitHub event and send it to the channel; the other event loop is to take out the message sent from the channel and forward it to the backend service.

This is my second project written in Rust. Any code review will be very appreciated! Currently, it works as I have deployed a revised version of it which contains the backend service forwarding logic.

Thanks all for looking at this thread.

Some comments:

  • You added the tracing middleware, and yet you are not using it. Change the eprintln instances for tracing::error, and instances of println for tracing::info.
  • GithubEvent::get_comment returns an owned String, yet in all the use places that I could find it was used as a &String, so I assume that the consumers are expecting &str rather than an owned String. This is probably the case for other methods as well.
  • Using underscore to get away from using reserved keywords in fields makes me feel unconfortable. Rather than using _type, I suggest that you use r#type.
1 Like

Thank you for your comments @moy2010 . All of them are indeed good advice. I will address them. Thanks again.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.