Search in sources :

Example 1 with SimpleMessage

use of org.jenkinsci.plugins.pubsub.SimpleMessage in project blueocean-plugin by jenkinsci.

the class PipelineEventListener method newMessage.

private static Message newMessage(PipelineEventChannel.Event event, FlowExecution exec) {
    SimpleMessage message = new SimpleMessage().setChannelName(PipelineEventChannel.NAME).setEventName(event);
    Run<?, ?> run = runFor(exec);
    if (run != null) {
        message.set(PipelineEventChannel.EventProps.pipeline_job_name, run.getParent().getFullName()).set(PipelineEventChannel.EventProps.pipeline_run_id, run.getId());
    }
    return message;
}
Also used : SimpleMessage(org.jenkinsci.plugins.pubsub.SimpleMessage)

Example 2 with SimpleMessage

use of org.jenkinsci.plugins.pubsub.SimpleMessage in project blueocean-plugin by jenkinsci.

the class AbstractMultiBranchCreateRequest method _sendMultibranchIndexingCompleteEvent.

private void _sendMultibranchIndexingCompleteEvent(MultiBranchProject mbp, int iterations) {
    try {
        SimpleMessage msg = new SimpleMessage();
        msg.set("jenkins_object_type", "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject");
        msg.set("job_run_status", "ALLOCATED");
        msg.set("job_name", mbp.getName());
        msg.set("jenkins_org", "jenkins");
        msg.set("job_orgfolder_indexing_status", "COMPLETE");
        msg.set("job_run_queueId", "1");
        msg.set("jenkins_object_name", mbp.getName());
        msg.set("blueocean_job_rest_url", "/blue/rest/organizations/jenkins/pipelines/" + mbp.getName() + "/");
        msg.set("jenkins_event", "job_run_queue_task_complete");
        msg.set("job_multibranch_indexing_result", "SUCCESS");
        msg.set("blueocean_job_pipeline_name", mbp.getName());
        msg.set("jenkins_object_url", "job/" + mbp.getName() + "/");
        msg.set("jenkins_channel", "job");
        msg.set("jenkinsfile_present", "false");
        PubsubBus.getBus().publish(msg);
    } catch (MessageException e) {
        throw new RuntimeException(e);
    }
}
Also used : MessageException(org.jenkinsci.plugins.pubsub.MessageException) SimpleMessage(org.jenkinsci.plugins.pubsub.SimpleMessage)

Aggregations

SimpleMessage (org.jenkinsci.plugins.pubsub.SimpleMessage)2 MessageException (org.jenkinsci.plugins.pubsub.MessageException)1