rest/src/main/java/org/jboss/pnc/rest/endpoint/DebugEndpoint.java
@POST
    @Path("/mq-send-dummy-message")
    public Response sendDummyMessageToQueue(@QueryParam("type") String type) {
        Optional<MessageSender> messageSender = messageSenderProvider.getMessageSender();
        if (!messageSender.isPresent()) {
            return Response
                    .status(Response.Status.SERVICE_UNAVAILABLE)
                    .entity("Message sender is not available to inject.")
                    .build();
        } else {
            if (type != null && type.equals("status")) {
                buildStatusChangedEventNotifier.fire(new DefaultBuildStatusChangedEvent(
                        newBuild(),BuildCoordinationStatus.CANCELLED
                        ));
            } else {
                messageSender.get().sendToTopic("Test Message.");
            }
            return Response.ok().build();
        }
    }
@POST
    @Path("/mq-send-dummy-message")
    public Response sendDummyMessageToQueue(@QueryParam("type") String type) {
        Optional<MessageSender> messageSender = messageSenderProvider.getMessageSender();
        if (!messageSender.isPresent()) {
            return Response
                    .status(Response.Status.SERVICE_UNAVAILABLE)
                    .entity("Message sender is not available to inject.")
                    .build();
        } else {
            if (type != null && type.equals("status")) {
                buildStatusChangedEventNotifier.fire(new DefaultBuildStatusChangedEvent(
                        newBuild(),BuildCoordinationStatus.CANCELLED
                        ));
            } else {
                messageSender.get().sendToTopic("Test Message.");
            }
            return Response.ok().build();
        }
    }
@ POST @ Path ( "/mq-send-dummy-message" ) public Response sendDummyMessageToQueue ( @ QueryParam ( "type" ) String type ) { Optional < MessageSender > messageSender = messageSenderProvider . getMessageSender ( ) ; if ( ! messageSender . isPresent ( ) ) { return Response . status ( Response . Status . SERVICE_UNAVAILABLE ) . entity ( "Message sender is not available to inject." ) . build ( ) ; } else { if ( type != null && type . equals ( "status" ) ) { buildStatusChangedEventNotifier . fire ( new DefaultBuildStatusChangedEvent ( newBuild ( ) , BuildCoordinationStatus . CANCELLED ) ) ; } else { messageSender . get ( ) . sendToTopic ( "Test Message." ) ; } return Response . ok ( ) . build ( ) ; } }
curl -v -X POST http://localhost:8080/pnc-rest/rest/debug/mq-send-dummy-message
curl -v -X POST http://localhost:8080/pnc-rest/rest/debug/mq-send-dummy-message?type=status
curl - v - X POST http : // localhost : 8080 / pnc - rest / rest / debug / mq - send - dummy - message curl - v - X POST http : // localhost : 8080 / pnc - rest / rest / debug / mq - send - dummy - message?type = status