Skip to content

Instantly share code, notes, and snippets.

@jonashackt
Last active December 4, 2015 13:17
Show Gist options
  • Save jonashackt/7ec053e82bb496d92568 to your computer and use it in GitHub Desktop.
Save jonashackt/7ec053e82bb496d92568 to your computer and use it in GitHub Desktop.
Define Method as RabbitMQ-Queue-Listener via Annotation
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import de.codecentric.microplode.configuration.MessagingConfiguration;
import de.codecentric.microplode.messaging.api.Event;
@Component
public class EventResultHandler {
@RabbitListener(queues=MessagingConfiguration.queueNameComputerPlayer)
public void handleMessage(@Payload Event event) {
System.out.println("Event received");
System.out.println("EventType: " + event.getType().getText());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment