I would suggest separating business logic module from the communication module.
The business logic module would cover the data processing and would have some interface to the communication logic module.
The communication module would be in charge solely on receiving and sending the messages, without any data processing, apart from basic data validation. The communication module would implement Strategy Pattern, where the business logic module would invoke an exposed interface of the communication module, which, in turn would have two implementations: one using RabbitMq and the other using Kafka.
Assuming your application has the same business logic, regardless of whether you use RabbitMq or Kafka (otherwise you would not be asking this question), you would abstract that business logic, not the event handlers per se.
Let's say that Rabbit Mq has a ShutDown event handler, and Kafka has something called Stop event handler (probably doesn't, but for the sake of the argument). This functionality would be abstracted through the
ICommunication interface (for example), using method
StopWorking. Then, RabbitMq would implement it using ShutDown, and Kafka would implement it using Stop. Business logic module would see
ICommunication.StopWorking. Whatever happens beyond that is of no concern to it and is separated from that part.