/*
(non-Javadoc)
@see org.springframework.context.ApplicationEventPublisher#publishEvent(org.springframework.context.ApplicationEvent)
338356
@SuppressWarnings("unchecked")
	@Override
	public void publishEvent(ApplicationEvent event) {

		if (event instanceof MappingContextEvent) {
			this.schmeaCreator
					.onApplicationEvent((MappingContextEvent<SolrPersistentEntity<?>, SolrPersistentProperty>) event);
		}
	}
1153658
public void webEvent(final WebEvent webEvent) {

		if (LOG.isDebugEnabled()) {
			LOG.debug("Sending web event " + webEvent + " for bundle "
					+ webEvent.getBundleName());
		}

		synchronized (listeners) {
			callListeners(webEvent);
			states.put(webEvent.getBundleId(), webEvent);
		}

		final String topic;
		switch (webEvent.getType()) {
			case WebEvent.DEPLOYING:
				topic = WebTopic.DEPLOYING.toString();
				break;
			case WebEvent.DEPLOYED:
				topic = WebTopic.DEPLOYED.toString();
				break;
			case WebEvent.UNDEPLOYING:
				topic = WebTopic.UNDEPLOYING.toString();
				break;
			case WebEvent.UNDEPLOYED:
				topic = WebTopic.UNDEPLOYED.toString();
				break;
			case WebEvent.FAILED:
				topic = WebTopic.FAILED.toString();
				break;
			case WebEvent.WAITING:
				// topic = WebTopic.WAITING.toString();
				// A Waiting Event is not supported by the specification
				// therefore it is mapped to FAILED, because of collision.
				topic = WebTopic.FAILED.toString();
				break;
			default:
				topic = WebTopic.FAILED.toString();
		}

		try {
			executors.submit(new Runnable() {
				public void run() {
					Dictionary<String, Object> properties = new Hashtable<>();
					properties.put("bundle.symbolicName", webEvent
							.getBundleName());
					properties.put("bundle.id", webEvent.getBundleId());
					String bundleVersionObject = webEvent.getBundleVersion();
					Version bundleVersion;
					if (bundleVersionObject != null) {
						bundleVersion = new Version(
								(String) bundleVersionObject);
					} else {
						bundleVersion = new Version("0.0.0");
					}
					properties.put("bundle.version", bundleVersion);
					properties.put("context.path",
							webEvent.getContextPath());
					properties.put("timestamp", webEvent.getTimestamp());
					properties.put("extender.bundle.id", webEvent
							.getExtenderBundleId());
					properties.put("extender.bundle.symbolicName", webEvent
							.getExtenderBundleName());
					String extenderBundleVersionObject = webEvent
							.getExtenderBundleVersion();
					Version extenderVersion;
					if (extenderBundleVersionObject != null) {
						extenderVersion = new Version(
								(String) extenderBundleVersionObject);
					} else {
						extenderVersion = new Version("0.0.0");
					}
					properties.put("extender.bundle.version",
							extenderVersion);

					if (webEvent.getCause() != null) {
						properties.put("exception", webEvent.getCause());
					}

					if (webEvent.getCollisionIds() != null) {
						properties.put("collision",
								webEvent.getContextPath());
						properties.put("collision.bundles",
								webEvent.getCollisionIds());
					}

					Event event = new Event(topic, properties);
					EventAdmin adminService = getEventAdmin();
					if (adminService != null) {
						adminService.postEvent(event);
					}

				}
			});
		} catch (RejectedExecutionException ree) {
			LOG.warn("Executor shut down", ree);
		}

		try {
			executors.submit(new Runnable() {
				public void run() {
					LogService logService = getLogService();
					if (logService != null) {
						logService.log(LogService.LOG_DEBUG, topic);
					} else {
						if (webEvent.getCause() != null) {
							LOG.error(webEvent.toString());
						} else {
							LOG.debug(topic);
						}
					}
				}
			});
		} catch (RejectedExecutionException ree) {
			LOG.warn("Executor shut down", ree);
		}

	}
180119
private static void publishEvent(String event, SiteNode node) {
		ZAP.getEventBus().publishSyncEvent(SiteMapEventPublisher.getPublisher(), new Event(SiteMapEventPublisher.getPublisher(), event, new Target(node)));
	}
49078
@Override
    public void publish(String mapName, String cacheId, EventData eventData,
                        int orderKey, Extractors extractors) {
        checkHasText(mapName, "mapName");
        checkHasText(cacheId, "cacheId");
        checkNotNull(eventData, "eventData cannot be null");

        publishLocalEvent(cacheId, eventData, extractors);
    }
1273806
private void publishStartedEvent() {
        BatchEventsPublisher publisher = getBatchEventsPublisher();
        if (publisher != null) {

            publisher.publishSplitFlowEvent(getSplitName(),
                                            getFlowName(),
                                            getTopLevelInstanceId(),
                                            getTopLevelExecutionId(),
                                            BatchEventsPublisher.TOPIC_EXECUTION_SPLIT_FLOW_STARTED,
                                            correlationId);
        }
    }
501165
private void onMessageSent(MessageSentEvent event) {
        handler.post(() -> listener.onMessageSent(event));
        log("Event published " + event.toString());
    }
32247
public void publish(byte[] message, EventBus bus) {
        bus.publish(getBinaryWriteHandlerId(), Buffer.buffer(message));
    }
462307
private void publishEvent(WSJobExecution jobEx, String topicToPublish, String correlationId) {
        if (eventsPublisher != null) {
            eventsPublisher.publishJobExecutionEvent(jobEx, topicToPublish, correlationId);
        }
    }
1209552
private void publishEndedEvent() {
        BatchEventsPublisher publisher = getBatchEventsPublisher();
        if (publisher != null) {

            publisher.publishSplitFlowEvent(getSplitName(),
                                            getFlowName(),
                                            getTopLevelInstanceId(),
                                            getTopLevelExecutionId(),
                                            BatchEventsPublisher.TOPIC_EXECUTION_SPLIT_FLOW_ENDED,
                                            correlationId);
        }
    }
1166403
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo) {
        if (getBatchEventsPublisher() != null) {
            getBatchEventsPublisher().publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId);
        }
    }
195013
@AfterReturning(pointcut = "createTicketGrantingTicketMethodExecution()", returning = "ticketGrantingTicketId")
	public void publishCasSsoSessionEstablishedEvent(final JoinPoint jp, final String ticketGrantingTicketId) {
		doPublish(new CasSsoSessionEstablishedEvent(jp.getTarget(), this.authenticationSupport.getAuthenticationFrom(ticketGrantingTicketId), ticketGrantingTicketId));
	}
793053
@Override
	public void publish(Event event) {

		// Check state
		if (status.get() == STATUS_STOPPED) {
			return;
		}

		// Connected
		if (event instanceof ConnectedEvent) {
			if (status.compareAndSet(STATUS_CONNECTING, STATUS_CONNECTED)) {

				// Redis connection is Ok
				logger.info("Redis get-set connection are estabilished.");
			}
			return;
		}

		// Disconnected
		if (event instanceof DisconnectedEvent) {
			int s = status.getAndSet(STATUS_DISCONNECTED);
			if (s != STATUS_DISCONNECTED) {
				logger.info("Redis get-set connection aborted.");
				reconnect();
			}
		}

	}
945533
@Override
    public void publishEvent(FacesContext context,
                             Class<? extends SystemEvent> systemEventClass,
                             Object source) {
        getWrapped().publishEvent(context, systemEventClass, source);
    }
144155
def publish_and_get_event(self, resource):
        """"""
        l_subscribed = False
        this_event = None

        if not self.__subscribed:
            self._get_event_stream()
            self._subscribe_myself()
            l_subscribed = True

        status = self.publish(
            action='get',
            resource=resource,
            mode=None,
            publish_response=False)

        if status == 'success':
            i = 0
            while not this_event and i < 2:
                self.__event_handle.wait(5.0)
                self.__event_handle.clear()
                _LOGGER.debug("Instance %s resource: %s", str(i), resource)
                for event in self.__events:
                    if event['resource'] == resource:
                        this_event = event
                        self.__events.remove(event)
                        break
                i = i + 1

        if l_subscribed:
            self._unsubscribe_myself()
            self._close_event_stream()
            l_subscribed = False

        return this_event
151030
private void onMessageRead(MessageReadEvent event) {
        handler.post(() -> listener.onMessageRead(event));
        log("Event published " + event.toString());
    }
1160470
func (c *DefaultPublisher) PublishAppEvent(appID string, eventType types.EventType, payload interface{}) error {
	key := ApplicationKey{appID, AppEvents, string(eventType)}
	msg, err := json.Marshal(payload)
	if err != nil {
		return fmt.Errorf("Unable to marshal the message payload: %s", err)
	}
	c.publish(key.String(), msg, time.Now())
	return nil
}
444301
public void publish(Object event) {
        Objects.requireNonNull(event, Required.EVENT.toString());
        
        this.eventBus.post(event);
        this.events.getAndIncrement();
    }