public QuartzScheduling(String name, Options<CreateOption> options) { this.name = name; this.numThreads = options.getInt(CreateOption.NUM_THREADS); }
public Integer getInt(T key) { return getInt(key, null); }
public synchronized MessageHandlerGroup start() throws Exception { if (!this.started) { Integer option = this.options.getInt(ListenOption.CONCURRENCY); int concurrency = option != null ? option : this.destination.defaultConcurrency(); log.info("Starting listener for '" + this.destination.name() + "' concurrency=" + concurrency); while(concurrency-- > 0) { listeners.add(createListener(this.handler, this.codecs, this.destination, this.context, this.options)); } this.started = true; } return this; }
void evict() { builder.eviction() .strategy(EvictionStrategy.valueOf(options.getString(Caching.CreateOption.EVICTION).toUpperCase())) .maxEntries(options.getInt(Caching.CreateOption.MAX_ENTRIES)); } void expire() {
protected ConnectionFactory createRemoteConnectionFactory(final Options<CreateContextOption> options) { //TODO: possibly cache the remote cf's? Map<String, Object> transportOpts = new HashMap<>(); transportOpts.put("host", options.getString(CreateContextOption.HOST)); transportOpts.put("port", options.getInt(CreateContextOption.PORT)); if (REMOTE_TYPE_WILDFLY.equals(options.getString(CreateContextOption.REMOTE_TYPE))) { transportOpts.put("http-upgrade-enabled", true); } TransportConfiguration config = new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory", transportOpts); HornetQConnectionFactory hornetQcf = HornetQJMSClient .createConnectionFactoryWithoutHA(options.has(CreateContextOption.XA) ? JMSFactoryType.XA_CF : JMSFactoryType.CF, config); hornetQcf.setReconnectAttempts(options.getInt(CreateContextOption.RECONNECT_ATTEMPTS)); hornetQcf.setRetryInterval(options.getLong(CreateContextOption.RECONNECT_RETRY_INTERVAL)); hornetQcf.setRetryIntervalMultiplier(options.getDouble(CreateContextOption.RECONNECT_RETRY_INTERVAL_MULTIPLIER)); hornetQcf.setMaxRetryInterval(options.getLong(CreateContextOption.RECONNECT_MAX_RETRY_INTERVAL)); // We have to cast for HornetQ 2.3 - the factory object that is returned is both a HornetQConnectionFactory // and a javax.jms.ConnectionFactory, but HornetQConnectionFactory doesn't implement j.j.ConnectionFactory. // With HornetQ 2.4, this cast is redundant. return (ConnectionFactory)hornetQcf; }
protected Trigger initTrigger(String name, Options<ScheduleOption> opts) { TriggerBuilder<Trigger> builder = TriggerBuilder.newTrigger() .withIdentity(name, name()); if (opts.has(AT)) { builder.startAt(opts.getDate(AT)); } else if (opts.has(IN)) { builder.startAt(new java.util.Date(System.currentTimeMillis() + opts.getLong(IN))); } else { builder.startNow(); } if (opts.has(UNTIL)) { builder.endAt(opts.getDate(UNTIL)); } if (opts.has(CRON)) { builder.withSchedule(CronScheduleBuilder.cronSchedule(opts.getString(CRON))); } else if (opts.has(EVERY)) { SimpleScheduleBuilder schedule = SimpleScheduleBuilder.simpleSchedule() .withIntervalInMilliseconds(opts.getInt(EVERY)); if (opts.has(LIMIT)) { schedule.withRepeatCount(opts.getInt(LIMIT) - 1); } else { schedule.repeatForever(); } builder.withSchedule(schedule); } return builder.build(); }
opts.getBoolean(PublishOption.PERSISTENT) ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT, opts.getInt(PublishOption.PRIORITY), opts.getLong(PublishOption.TTL, producer.getTimeToLive())); } finally {
@Override public Reply onMessage(Message msg, Context context) throws Exception { Reply result = handler.onMessage(msg, context); Options<MessageOpOption> replyOptions = new Options<>(); replyOptions.put(PublishOption.TTL, opts.getInt(RespondOption.TTL)); replyOptions.put(PublishOption.CONTEXT, context); replyOptions.put(PublishOption.PROPERTIES, result.properties()); ((ReplyableMessage)msg).reply(result.content(), codecs.forContentType(msg.contentType()), replyOptions); return null; } };
@Override public Message receive(Codecs codecs, Map<MessageOpOption, Object> options) throws Exception { Options<MessageOpOption> opts = new Options<>(options); int timeout = opts.getInt(ReceiveOption.TIMEOUT); JMSSpecificContext context = context(opts.get(MessageOpOption.CONTEXT)); Session jmsSession = context.jmsSession();
private void configure(Options<CreateOption> options) { autoStart = options.getBoolean(CreateOption.AUTO_START); Undertow.Builder builder = (Undertow.Builder) options.get(CreateOption.CONFIGURATION); if (builder != null) { undertow = builder .setHandler(Handlers.header(pathology.handler(), Headers.SERVER_STRING, "undertow")) .build(); } else { int port = options.getInt(CreateOption.PORT); String host = options.getString(CreateOption.HOST); undertow = Undertow.builder() .addHttpListener(port, host) .setHandler(Handlers.header(pathology.handler(), Headers.SERVER_STRING, "undertow")) .build(); } }