Publish jms topic if batch jms event is available

@param objectToPublish WSJobInstance
@param eventToPublish
164077
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo, String correlationId) {
        if (eventsPublisher != null) {
            eventsPublisher.publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId);
        }
    }
720733
public void onPost(final GitHubTriggerEvent event) {
        if (Objects.isNull(job)) {
            return; // nothing to do
        }

        Job<?, ?> currentJob = notNull(job, "Job can't be null");

        final String pushBy = event.getTriggeredByUser();
        DescriptorImpl d = getDescriptor();
        d.checkThreadPoolSizeAndUpdateIfNecessary();
        d.queue.execute(new Runnable() {
            private boolean runPolling() {
                try {
                    StreamTaskListener listener = new StreamTaskListener(getLogFileForJob(currentJob));

                    try {
                        PrintStream logger = listener.getLogger();

                        long start = System.currentTimeMillis();
                        logger.println("Started on " + DateFormat.getDateTimeInstance().format(new Date()));
                        if (event.getOrigin() != null) {
                            logger.format("Started by event from %s on %tc%n", event.getOrigin(), event.getTimestamp());
                        }
                        SCMTriggerItem item = SCMTriggerItems.asSCMTriggerItem(currentJob);
                        if (null == item) {
                            throw new IllegalStateException("Job is not an SCMTriggerItem: " + currentJob);
                        }
                        boolean result = item.poll(listener).hasChanges();
                        logger.println("Done. Took " + Util.getTimeSpanString(System.currentTimeMillis() - start));
                        if (result) {
                            logger.println("Changes found");
                        } else {
                            logger.println("No changes");
                        }
                        return result;
                    } catch (Error e) {
                        e.printStackTrace(listener.error("Failed to record SCM polling"));
                        LOGGER.error("Failed to record SCM polling", e);
                        throw e;
                    } catch (RuntimeException e) {
                        e.printStackTrace(listener.error("Failed to record SCM polling"));
                        LOGGER.error("Failed to record SCM polling", e);
                        throw e;
                    } finally {
                        listener.close();
                    }
                } catch (IOException e) {
                    LOGGER.error("Failed to record SCM polling", e);
                }
                return false;
            }

            public void run() {
                if (runPolling()) {
                    GitHubPushCause cause;
                    try {
                        cause = new GitHubPushCause(getLogFileForJob(currentJob), pushBy);
                    } catch (IOException e) {
                        LOGGER.warn("Failed to parse the polling log", e);
                        cause = new GitHubPushCause(pushBy);
                    }

                    if (asParameterizedJobMixIn(currentJob).scheduleBuild(cause)) {
                        LOGGER.info("SCM changes detected in " + currentJob.getFullName()
                                + ". Triggering #" + currentJob.getNextBuildNumber());
                    } else {
                        LOGGER.info("SCM changes detected in " + currentJob.getFullName()
                                + ". Job is already in the queue");
                    }
                }
            }
        });
    }
32247
public void publish(byte[] message, EventBus bus) {
        bus.publish(getBinaryWriteHandlerId(), Buffer.buffer(message));
    }
700702
private void publishPurgeEvent(WSJobInstance jobInstance) {
        if (eventsPublisher != null) {
            eventsPublisher.publishJobInstanceEvent(jobInstance, BatchEventsPublisher.TOPIC_INSTANCE_PURGED, null);
        }
    }
336708
function publish(topic, msg) {
  if (!topic || !msg || typeof topic !== 'string' || typeof msg !== 'object') {
    throw new Error('A `topic` (string) and `msg` (object) property must be defined');
  }

  if (module.exports.client && BUS_MODULE) {
    module.exports.client.publish(`${NAMESPACE}:${topic}`, msg);
  } else if (module.exports.client) {
    module.exports.client.publish(`${NAMESPACE}:${topic}`, JSON.stringify(msg));
  }
}
625311
private void postRoutedServerNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti, ObjectName listener,
                                                                       NotificationFilter filter, Object handback) {
        Map<String, Object> props = createServerListenerRegistrationEvent(operation, nti, listener, filter, handback);
        safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
    }
123301
protected void fireFinish(CmsPublishJobRunning publishJob) {

        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_PUBLISH_JOB_FINISH_0));
        }
        for (Iterator<I_CmsPublishEventListener> it = iterator(); it.hasNext();) {
            I_CmsPublishEventListener listener = it.next();
            try {
                listener.onFinish(publishJob);
            } catch (Throwable t) {
                // catch every thing including runtime exceptions
                if (LOG.isErrorEnabled()) {
                    LOG.error(
                        Messages.get().getBundle().key(
                            Messages.ERR_PUBLISH_JOB_FINISH_ERROR_1,
                            listener.getClass().getName()),
                        t);
                }
                if (publishJob.m_publishJob.getPublishReport() != null) {
                    publishJob.m_publishJob.getPublishReport().println(t);
                }
            }
        }
        // popup the finish message
        String msgText;
        boolean hasError = false;
        if (!publishJob.getReport().hasError() && !publishJob.getReport().hasWarning()) {
            msgText = Messages.get().getBundle(publishJob.getLocale()).key(
                Messages.GUI_PUBLISH_JOB_FINISHED_1,
                new Long(publishJob.getEnqueueTime()));
        } else {
            hasError = true;
            Object[] params = new Object[] {
                new Long(publishJob.getEnqueueTime()),
                new Integer(publishJob.getReport().getErrors().size()),
                new Integer(publishJob.getReport().getWarnings().size())};
            msgText = Messages.get().getBundle(publishJob.getLocale()).key(
                Messages.GUI_PUBLISH_JOB_FINISHED_WITH_WARNS_3,
                params);
        }
        m_publishEngine.sendMessage(publishJob.getUserId(), msgText, hasError);
    }
880023
public void sendEvent(EventBuilder eventBuilder) {
        if (!Util.isNullOrEmpty(release)) {
            eventBuilder.withRelease(release.trim());
            if (!Util.isNullOrEmpty(dist)) {
                eventBuilder.withDist(dist.trim());
            }
        }

        if (!Util.isNullOrEmpty(environment)) {
            eventBuilder.withEnvironment(environment.trim());
        }

        if (!Util.isNullOrEmpty(serverName)) {
            eventBuilder.withServerName(serverName.trim());
        }

        for (Map.Entry<String, String> tagEntry : tags.entrySet()) {
            eventBuilder.withTag(tagEntry.getKey(), tagEntry.getValue());
        }

        for (Map.Entry<String, Object> extraEntry : extra.entrySet()) {
            eventBuilder.withExtra(extraEntry.getKey(), extraEntry.getValue());
        }

        runBuilderHelpers(eventBuilder);
        Event event = eventBuilder.build();
        sendEvent(event);
    }
121996
public static String getMessageSelector(String eventName, IPublisherInfo publisherInfo) {
        StringBuilder sb = new StringBuilder(
                "(JMSType='" + eventName + "' OR JMSType LIKE '" + eventName + ".%') AND (Recipients IS NULL");
        
        if (publisherInfo != null) {
            for (String selector : publisherInfo.getAttributes().values()) {
                addRecipientSelector(selector, sb);
            }
        }
        
        sb.append(')');
        return sb.toString();
    }
264647
function publishChanges (eventName, stateId) {
      var subscriptions = instanceSubscriptions[instanceId];

      if(!subscriptions) return;

      subscriptions.forEach(function (response) {
        response.write('event: ' + eventName +'\n');
        response.write('data: ' + stateId + '\n\n');
      });
    }
904889
private void publishCheckpointEvent(String stepName, long jobInstanceId, long jobExecutionId, long stepExecutionId) {
        BatchEventsPublisher publisher = getBatchEventsPublisher();

        if (publisher != null) {
            String correlationId = runtimeWorkUnitExecution.getCorrelationId();
            publisher.publishCheckpointEvent(stepName, jobInstanceId, jobExecutionId, stepExecutionId, correlationId);
        }
    }
1359585
public <E extends Event> void publish(E event) {
        if (!eventListenerMap.isEmpty()) {
            EventListener<E> eventListener = getEventListener(event);
            if (eventListener != null) {
                eventListener.on(event);
            }
        }
    }
1128626
public void buildForMissingInterval(@Nullable final LocalDate startDate, @Nullable final LocalDate endDate, @Nullable final UUID targetInvoiceId, final Collection<Item> output, final boolean addRepair) {
        final Item item = createNewItem(startDate, endDate, targetInvoiceId, addRepair);
        if (item != null) {
            output.add(item);
        }
    }
76877
@Override
    public void publish(final Interaction.Execution<?, ?> execution) {

        final InteractionDto interactionDto = InteractionDtoUtils.newInteractionDto(execution);

        persist(execution);

        sendUsingJms(interactionDto);
    }
209073
protected void publishInternal(final RegisteredService service, final ApplicationEvent event) {

        if (event instanceof CasRegisteredServiceDeletedEvent) {
            handleCasRegisteredServiceDeletedEvent(service, event);
            return;
        }
        if (event instanceof CasRegisteredServiceSavedEvent || event instanceof CasRegisteredServiceLoadedEvent) {
            handleCasRegisteredServiceUpdateEvents(service, event);
            return;
        }
        LOGGER.warn("Unsupported event [{}} for service replication", event);
    }
476045
public void publish(TaskEvent event) {
		synchronized (listeners) {
			for (EventListener<TaskEvent> listener : listeners.get(event.getClass())) {
				listener.onEvent(event);
			}
		}
	}
932997
public void broadcastTextMessage(String topicName, String textMessage, int delaySeconds)
            throws NamingException, JMSException, ServiceLocatorException {
        if (mdwMessageProducer != null) {
            mdwMessageProducer.broadcastMessageToTopic(topicName, textMessage);
        }
        else {
            TopicConnectionFactory tFactory = null;
            TopicConnection tConnection = null;
            TopicSession tSession = null;
            TopicPublisher tPublisher = null;
            try {
                // if (logger.isDebugEnabled()) logger.debug("broadcast JMS
                // message: " +
                // textMessage);
                // cannot log above - causing recursive broadcasting
                tFactory = getTopicConnectionFactory(null);
                tConnection = tFactory.createTopicConnection();
                tSession = tConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
                Topic topic = getTopic(topicName);
                tPublisher = tSession.createPublisher(topic);

                // TODO: platform-independent delay
                // WLMessageProducer wlMessageProducer =
                // (WLMessageProducer)tPublisher;
                // long delayInMilliSec = 0;
                // if(pMinDelay > 0){
                // delayInMilliSec = delaySeconds*1000;
                // }
                // wlMessageProducer.setTimeToDeliver(delayInMilliSec);
                TextMessage message = tSession.createTextMessage();
                tConnection.start();

                message.setText(textMessage);
                tPublisher.publish(message, DeliveryMode.PERSISTENT,
                        TextMessage.DEFAULT_DELIVERY_MODE, TextMessage.DEFAULT_TIME_TO_LIVE);
                // }catch(ServiceLocatorException ex){
                // ex.printStackTrace();
                // never log exception here!!! infinite loop when publishing log
                // messages
                // throw new JMSException(ex.getMessage());
            }
            finally {
                closeResources(tConnection, tSession, tPublisher);

            }
        }
    }