本文整理汇总了Java中org.springframework.context.ApplicationEventPublisher.publishEvent方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationEventPublisher.publishEvent方法的具体用法?Java ApplicationEventPublisher.publishEvent怎么用?Java ApplicationEventPublisher.publishEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.context.ApplicationEventPublisher
的用法示例。
在下文中一共展示了ApplicationEventPublisher.publishEvent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BatchProcessor
import org.springframework.context.ApplicationEventPublisher; //导入方法依赖的package包/类
/**
* Instantiates a new batch processor.
*
* @param processName
* the process name
* @param retryingTransactionHelper
* the retrying transaction helper
* @param workProvider
* the object providing the work packets
* @param workerThreads
* the number of worker threads
* @param batchSize
* the number of entries we process at a time in a transaction
* @param applicationEventPublisher
* the application event publisher (may be <tt>null</tt>)
* @param logger
* the logger to use (may be <tt>null</tt>)
* @param loggingInterval
* the number of entries to process before reporting progress
*
* @since 3.4
*/
public BatchProcessor(
String processName,
RetryingTransactionHelper retryingTransactionHelper,
BatchProcessWorkProvider<T> workProvider,
int workerThreads, int batchSize,
ApplicationEventPublisher applicationEventPublisher,
Log logger,
int loggingInterval)
{
this.threadFactory = new TraceableThreadFactory();
this.threadFactory.setNamePrefix(processName);
this.threadFactory.setThreadDaemon(true);
this.processName = processName;
this.retryingTransactionHelper = retryingTransactionHelper;
this.workProvider = workProvider;
this.workerThreads = workerThreads;
this.batchSize = batchSize;
if (logger == null)
{
this.logger = LogFactory.getLog(this.getClass());
}
else
{
this.logger = logger;
}
this.loggingInterval = loggingInterval;
// Let the (enterprise) monitoring side know of our presence
if (applicationEventPublisher != null)
{
applicationEventPublisher.publishEvent(new BatchMonitorEvent(this));
}
}
示例2: sell
import org.springframework.context.ApplicationEventPublisher; //导入方法依赖的package包/类
public void sell(ApplicationEventPublisher publisher) {
sold = true;
CarSold event = new CarSold(vin);
publisher.publishEvent(event);
}
示例3: publishConnectedEvent
import org.springframework.context.ApplicationEventPublisher; //导入方法依赖的package包/类
/**
* Publishes a {@link MqttClientConnectedEvent} message to the
* {@link ApplicationEventPublisher}.
* <p>
* If the {@link ApplicationEventPublisher} instance is null, no event message will be
* published.
*
* @param clientId the Client ID value
* @param serverUri the Server URI the MQTT Client is connected to
* @param subscribedTopics the Topic Filters the MQTT Client is subscribed to
* @param applicationEventPublisher the {@link ApplicationEventPublisher} value
* @param source the source that sent this event
*/
public void publishConnectedEvent(String clientId, String serverUri, String[] subscribedTopics,
ApplicationEventPublisher applicationEventPublisher, Object source)
{
if (applicationEventPublisher != null)
{
applicationEventPublisher.publishEvent(
new MqttClientConnectedEvent(clientId, serverUri, subscribedTopics, source));
}
}
示例4: publishConnectionFailureEvent
import org.springframework.context.ApplicationEventPublisher; //导入方法依赖的package包/类
/**
* Publishes a {@link MqttClientConnectionFailureEvent} message to the
* {@link ApplicationEventPublisher}.
* <p>
* If the {@link ApplicationEventPublisher} instance is null, no event message will be
* published.
*
* @param clientId the Client ID value
* @param autoReconnect whether the MQTT Client will automatically reconnect
* @param throwable the originating {@link Throwable}
* @param applicationEventPublisher the {@link ApplicationEventPublisher} value
* @param source the source that sent this event
*/
public void publishConnectionFailureEvent(String clientId, boolean autoReconnect,
Throwable throwable, ApplicationEventPublisher applicationEventPublisher, Object source)
{
if (applicationEventPublisher != null)
{
applicationEventPublisher.publishEvent(
new MqttClientConnectionFailureEvent(clientId, autoReconnect, throwable, source));
}
}
示例5: publishConnectionLostEvent
import org.springframework.context.ApplicationEventPublisher; //导入方法依赖的package包/类
/**
* Publishes a {@link MqttClientConnectionLostEvent} message to the
* {@link ApplicationEventPublisher}.
* <p>
* If the {@link ApplicationEventPublisher} instance is null, no event message will be
* published.
*
* @param clientId the Client ID value
* @param autoReconnect whether the MQTT Client will automatically reconnect
* @param applicationEventPublisher the {@link ApplicationEventPublisher} value
* @param source the source that sent this event
*/
public void publishConnectionLostEvent(String clientId, boolean autoReconnect,
ApplicationEventPublisher applicationEventPublisher, Object source)
{
if (applicationEventPublisher != null)
{
applicationEventPublisher
.publishEvent(new MqttClientConnectionLostEvent(clientId, autoReconnect, source));
}
}
示例6: publishDisconnectedEvent
import org.springframework.context.ApplicationEventPublisher; //导入方法依赖的package包/类
/**
* Publishes a {@link MqttClientDisconnectedEvent} message to the
* {@link ApplicationEventPublisher}.
* <p>
* If the {@link ApplicationEventPublisher} instance is null, no event message will be
* published.
*
* @param clientId the Client ID value
* @param applicationEventPublisher the {@link ApplicationEventPublisher} value
* @param source the source that sent this event
*/
public void publishDisconnectedEvent(String clientId,
ApplicationEventPublisher applicationEventPublisher, Object source)
{
if (applicationEventPublisher != null)
{
applicationEventPublisher
.publishEvent(new MqttClientDisconnectedEvent(clientId, source));
}
}
示例7: publishMessageDeliveredEvent
import org.springframework.context.ApplicationEventPublisher; //导入方法依赖的package包/类
/**
* Publishes a {@link MqttMessageDeliveredEvent} message to the
* {@link ApplicationEventPublisher}.
* <p>
* If the {@link ApplicationEventPublisher} instance is null, no event message will be
* published.
*
* @param clientId the Client ID value
* @param messageIdentifier the Message Identifier
* @param applicationEventPublisher the {@link ApplicationEventPublisher} value
* @param source the source that sent this event
*/
public void publishMessageDeliveredEvent(String clientId, int messageIdentifier,
ApplicationEventPublisher applicationEventPublisher, Object source)
{
if (applicationEventPublisher != null)
{
applicationEventPublisher
.publishEvent(new MqttMessageDeliveredEvent(clientId, messageIdentifier, source));
}
}
示例8: publishMessagePublishedEvent
import org.springframework.context.ApplicationEventPublisher; //导入方法依赖的package包/类
/**
* Publishes a {@link MqttMessagePublishedEvent} message to the
* {@link ApplicationEventPublisher}.
* <p>
* If the {@link ApplicationEventPublisher} instance is null, no event message will be
* published.
*
* @param clientId the Client ID value
* @param messageIdentifier the Message Identifier
* @param correlationId the Correlation ID
* @param applicationEventPublisher the {@link ApplicationEventPublisher} value
* @param source the source that sent this event
*/
public void publishMessagePublishedEvent(String clientId, int messageIdentifier,
String correlationId, ApplicationEventPublisher applicationEventPublisher, Object source)
{
if (applicationEventPublisher != null)
{
applicationEventPublisher.publishEvent(
new MqttMessagePublishedEvent(clientId, messageIdentifier, correlationId, source));
}
}