Skip to content

Instantly share code, notes, and snippets.

@vladdedita
Created November 29, 2023 09:10
Show Gist options
  • Save vladdedita/2c38c634f17a1aaeaaf0d0b0fb83c163 to your computer and use it in GitHub Desktop.
Save vladdedita/2c38c634f17a1aaeaaf0d0b0fb83c163 to your computer and use it in GitHub Desktop.
public interface MessageProcessor<T> {
void process(T message);
}
@Component
public class TextMessageProcessor implements MessageProcessor<TextMessage> {
@Override
public void process(TextMessage message) {
// Processing logic for text messages
}
}
@Component
public class ImageMessageProcessor implements MessageProcessor<ImageMessage> {
@Override
public void process(ImageMessage message) {
// Processing logic for image messages
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment