当前位置: 首页>>代码示例>>Java>>正文


Java MessageProcessingJob类代码示例

本文整理汇总了Java中org.kuali.rice.kcb.quartz.MessageProcessingJob的典型用法代码示例。如果您正苦于以下问题:Java MessageProcessingJob类的具体用法?Java MessageProcessingJob怎么用?Java MessageProcessingJob使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessageProcessingJob类属于org.kuali.rice.kcb.quartz包,在下文中一共展示了MessageProcessingJob类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queueJob

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
private void queueJob(MessageProcessingJob.Mode mode, long messageId, String user, String cause) {
    // queue up the processing job after the transaction has committed
    LOG.debug("registering synchronization");

    if (!TransactionSynchronizationManager.isSynchronizationActive()) {
    	throw new RiceRuntimeException("transaction syncronization is not active " +
    			"(!TransactionSynchronizationManager.isSynchronizationActive())");
    } else if (!TransactionSynchronizationManager.isActualTransactionActive()) {
    	throw new RiceRuntimeException("actual transaction is not active " +
    			"(!TransactionSynchronizationManager.isActualTransactionActive())");
    }

    TransactionSynchronizationManager.registerSynchronization(new QueueProcessingJobSynchronization(
        jobName,
        jobGroup,
        mode,
        messageId,
        user,
        cause,
        synchronous
    ));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:MessagingServiceImpl.java

示例2: QueueProcessingJobSynchronization

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
private QueueProcessingJobSynchronization(String jobName, String jobGroup, MessageProcessingJob.Mode mode, long messageId, String user, String cause, boolean synchronous) {
    this.jobName = jobName;
    this.jobGroup = jobGroup;
    this.mode = mode;
    this.messageId = messageId;
    this.user = user;
    this.cause = cause;
    this.synchronous = synchronous;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:MessagingServiceImpl.java

示例3: scheduleJob

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
private void scheduleJob() {
    LOG.debug("Queueing processing job");
    try {
        Scheduler scheduler = KSBServiceLocator.getScheduler();
        if (synchronous) {
            LOG.debug("Invoking job synchronously in Thread " + Thread.currentThread());
            MessageProcessingJob job = new MessageProcessingJob(messageId, mode, user, cause);
            job.run();
        } else {
            String uniqueTriggerName = jobName + "-Trigger-" + System.currentTimeMillis() + Math.random();
            SimpleTrigger trigger = new SimpleTrigger(uniqueTriggerName, jobGroup + "-Trigger");
            LOG.debug("Scheduling trigger: " + trigger);

            JobDataMap data = new JobDataMap();
            data.put("mode", mode.name());
            data.put("user", user);
            data.put("cause", cause);
            data.put("messageId", messageId);

            trigger.setJobName(jobName);
            trigger.setJobGroup(jobGroup);
            trigger.setJobDataMap(data);
            scheduler.scheduleJob(trigger);
        }
    } catch (SchedulerException se) {
        throw new RuntimeException(se);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:MessagingServiceImpl.java

示例4: registerJobListener

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
protected void registerJobListener() throws SchedulerException {
    KSBServiceLocator.getScheduler().addGlobalJobListener(new JobListenerSupport() {
        @Override
        public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
            log.info("Job was executed: " + context);
            if (MessageProcessingJob.NAME.equals(context.getJobDetail().getName())) {
                signal.countDown();
            }
        }
        public String getName() {
            return System.currentTimeMillis() + RandomStringUtils.randomAlphanumeric(10);
        }
    });
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:MessagingServiceTest.java

示例5: scheduleJob

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
private void scheduleJob() {
    LOG.debug("Queueing processing job");
    try {
        Scheduler scheduler = KSBServiceLocator.getScheduler();
        if (synchronous) {
            LOG.debug("Invoking job synchronously in Thread " + Thread.currentThread());
            MessageProcessingJob job = new MessageProcessingJob(messageId, mode, user, cause);
            job.run();
        } else {
            String uniqueTriggerName = jobName + "-Trigger-" + System.currentTimeMillis() + Math.random();
            SimpleTriggerImpl trigger = new SimpleTriggerImpl(uniqueTriggerName, jobGroup + "-Trigger");
            LOG.debug("Scheduling trigger: " + trigger);

            JobDataMap data = new JobDataMap();
            data.put("mode", mode.name());
            data.put("user", user);
            data.put("cause", cause);
            data.put("messageId", messageId);

            trigger.setJobName(jobName);
            trigger.setJobGroup(jobGroup);
            trigger.setJobDataMap(data);
            scheduler.scheduleJob(trigger);
        }
    } catch (SchedulerException se) {
        throw new RuntimeException(se);
    }
}
 
开发者ID:kuali,项目名称:rice,代码行数:29,代码来源:MessagingServiceImpl.java

示例6: registerJobListener

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
protected void registerJobListener() throws SchedulerException {
    KSBServiceLocator.getScheduler().getListenerManager().addJobListener(new JobListenerSupport() {
        @Override
        public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
            log.info("Job was executed: " + context);
            if (MessageProcessingJob.NAME.equals(((JobDetailImpl) context.getJobDetail()).getName())) {
                signal.countDown();
            }
        }

        public String getName() {
            return System.currentTimeMillis() + RandomStringUtils.randomAlphanumeric(10);
        }
    });
}
 
开发者ID:kuali,项目名称:rice,代码行数:16,代码来源:MessagingServiceTest.java

示例7: deliver

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
/**
     * @see org.kuali.rice.kcb.service.MessagingService#deliver(org.kuali.rice.kcb.dto.MessageDTO)
     */
    @Override
    public Long deliver(MessageDTO message) throws MessageDeliveryException {
        if (message == null) {
            throw new RiceIllegalArgumentException("message is null");
        }

        Collection<String> delivererTypes = getDelivererTypesForUserAndChannel(message.getRecipient(), message.getChannel());
        LOG.debug("Deliverer types for " + message.getRecipient() + "/" + message.getChannel() + ": " + delivererTypes.size());

        if (delivererTypes.isEmpty()) {
            // no deliverers configured? just skipp it
            LOG.debug("No deliverers are configured for " + message.getRecipient() + "/" + message.getChannel());
            return null;
        }

        Message m = new Message();
        m.setTitle(message.getTitle());
        m.setDeliveryType(message.getDeliveryType());
        m.setChannel(message.getChannel());
        m.setRecipient(message.getRecipient());
        m.setContentType(message.getContentType());
        m.setUrl(message.getUrl());
        m.setContent(message.getContent());
        m.setOriginId(message.getOriginId());

        LOG.debug("saving message: " +m);
        m = messageService.saveMessage(m);

        for (String type: delivererTypes) {
            
            MessageDelivery delivery = new MessageDelivery();
            delivery.setDelivererTypeName(type);
            delivery.setMessage(m);

//            MessageDeliverer deliverer = delivererRegistry.getDeliverer(delivery);
//            if (deliverer != null) {
//                deliverer.deliverMessage(delivery);
//            }
        
            LOG.debug("saving messagedelivery: " +delivery);
            messageDeliveryService.saveMessageDelivery(delivery);
        }

        LOG.debug("queuing job");
        queueJob(MessageProcessingJob.Mode.DELIVER, m.getId(), null, null);

        LOG.debug("returning");
        return m.getId();
    }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:53,代码来源:MessagingServiceImpl.java

示例8: remove

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
private void remove(Message message, String user, String cause) {
    queueJob(MessageProcessingJob.Mode.REMOVE, message.getId(), user, cause);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:4,代码来源:MessagingServiceImpl.java

示例9: deliver

import org.kuali.rice.kcb.quartz.MessageProcessingJob; //导入依赖的package包/类
/**
     * @see org.kuali.rice.kcb.service.MessagingService#deliver(org.kuali.rice.kcb.dto.MessageDTO)
     */
    @Override
    public Long deliver(MessageDTO message) throws MessageDeliveryException {
        if (message == null) {
            throw new RiceIllegalArgumentException("message is null");
        }

        Collection<String> delivererTypes = getDelivererTypesForUserAndChannel(message.getRecipient(), message.getChannel());
        LOG.debug("Deliverer types for " + message.getRecipient() + "/" + message.getChannel() + ": " + delivererTypes.size());

        if (delivererTypes.isEmpty()) {
            // no deliverers configured? just skipp it
            LOG.debug("No deliverers are configured for " + message.getRecipient() + "/" + message.getChannel());
            return null;
        }

        final Message m = new Message();
        m.setTitle(message.getTitle());
        m.setDeliveryType(message.getDeliveryType());
        m.setChannel(message.getChannel());
        m.setRecipient(message.getRecipient());
        m.setContentType(message.getContentType());
        m.setUrl(message.getUrl());
        m.setContent(message.getContent());
        m.setOriginId(message.getOriginId());

        LOG.debug("saving message: " +m);
        messageService.saveMessage(m);

        for (String type: delivererTypes) {
            
            MessageDelivery delivery = new MessageDelivery();
            delivery.setDelivererTypeName(type);
            delivery.setMessage(m);

//            MessageDeliverer deliverer = delivererRegistry.getDeliverer(delivery);
//            if (deliverer != null) {
//                deliverer.deliverMessage(delivery);
//            }
        
            LOG.debug("saving messagedelivery: " +delivery);
            messageDeliveryService.saveMessageDelivery(delivery);
        }

        LOG.debug("queuing job");
        queueJob(MessageProcessingJob.Mode.DELIVER, m.getId(), null, null);

        LOG.debug("returning");
        return m.getId();
    }
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:53,代码来源:MessagingServiceImpl.java


注:本文中的org.kuali.rice.kcb.quartz.MessageProcessingJob类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。