1 DestinationResolver
   DestinationResolver接å£çš„作用是ž®†æŒ‡å®šçš„目的地åè§£æžä¸ºç›®çš„地实例。其定义如下åQ?/p>
Â Â Â å‚æ•°pubSubDomain用于指定是ä‹É用“å‘å¸?è®¢é˜…â€æ¨¡å¼ï¼ˆè§£æžåŽçš„目的地是TopicåQ‰ï¼Œ˜q˜æ˜¯ä½¿ç”¨â€œç‚¹å¯¹ç‚¹â€æ¨¡å¼ï¼ˆè§£æžåŽçš„目的地是QueueåQ‰ã€?/p>
Â
   CachingDestinationResolver接壾l§æ‰¿äº†DestinationResolveråQŒå¢žåŠ äº†¾~“å˜çš„功能,其接å£å®šä¹‰å¦‚下:(x¨¬)
   在目的地失效的时候,removeFromCacheæ–ÒŽ(gu¨©)³•ä¼?x¨¬)被调用åQ›åœ¨JMS provider失效的时候,clearCacheæ–ÒŽ(gu¨©)³•ä¼?x¨¬)被调用ã€?br />
1.1 DynamicDestinationResolver
   DynamicDestinationResolver实现了DestinationResolver接å£ã€‚æ ¹æ®æŒ‡å®šçš„目的地ååQŒDynamicDestinationResolverä¼?x¨¬)动æ€åˆ›å»ºç›®çš„地实例。针对JMS1.1规范åQŒå®ƒé‡‡ç”¨å¦‚下æ–ÒŽ(gu¨©)³•创å¾ç›®çš„圎ͼš(x¨¬)
1.2 JndiDestinationResolver
   JndiDestinationResolver¾l§æ‰¿è‡ªJndiLocatorSupportåQ?
åŒæ—¶å®žçŽ°äº†CachingDestinationResolver接å£ã€‚如果在JMS
providerä¸é…¾|®äº†é™æ€ç›®çš„地åQŒé‚£ä¹ˆJndiDestinationResolver通过JNDI查找的方å¼èŽ·å¾—ç›®çš„åœ°å®žä¾‹ã€?/p>
  Â
JndiDestinationResolverçš„fallbackToDynamicDestination属性用于指定在JNDI查找å¤ÞpÓ|åŽï¼Œæ˜¯å¦ä½?
用动æ€ç›®çš„地åQŒé»˜è®¤å€¼æ˜¯false。JndiDestinationResolverçš„cache属性用于指定是å¦å¯¹ç›®çš„地实例进行缓å˜ï¼Œé»˜è®¤å€¼æ˜¯
true�/p>
Â
1.3 BeanFactoryDestinationResolver
   BeanFactoryDestinationResolver实现了DestinationResolver接å£å’ŒBeanFactoryAware接å£ã€‚它ä¼?x¨¬)æ ¹æ®æŒ‡å®šçš„目的地å从BeanFactory䏿Ÿ¥æ‰„¡›®çš„地实例。以下是相关的代ç :(x¨¬)
Â
2 JmsAccessor
  Â
抽象¾c»JmsAccessor是JmsTemplateã€SimpleMessageListenerContainerå’?
DefaultMessageListenerContainer½{‰concrete
class的基¾c…R€‚JmsAccessorå®šä¹‰äº†å¦‚ä¸‹å‡ ä¸ªç”¨äºŽè®¿é—®JMSæœåŠ¡çš„å…±é€šå±žæ€§ã€?/p>
   JmsAccessoræä¾›äº†åˆ›å»ºConnectionå’ŒSession的方法,如下åQ?/p>
Â
2.1 JmsDestinationAccessor
  Â
抽象¾c»JmsDestinationAccessor¾l§æ‰¿è‡ªJmsAccessoråQŒå¢žåŠ äº†destinationResolverå’?
pubSubDomain属性。destinationResolver的默认值是DynamicDestinationResolver的实例,也就�
说默认采用动æ€ç›®çš„地解æžçš„æ–¹å¼ï¼›pubSubDomain用于指定是ä‹É用“å‘å¸?è®¢é˜…â€æ¨¡å¼è¿˜æ˜¯ä‹Éç”¨â€œç‚¹å¯¹ç‚¹â€æ¨¡å¼ï¼Œé»˜è®¤å€¼æ˜¯falseã€?br />
   JmsDestinationAccessoræä¾›äº†ç”¨äºŽè§£æžç›®çš„地的方法,如下åQ?/p>
2.2 AbstractJmsListeningContainer
   AbstractJmsListeningContainer¾l§æ‰¿è‡ªJmsDestinationAccessoråQŒä½œä¸ºæ‰€æœ‰Message
Listener Container的公共基¾c…R€‚å®ƒä¸»è¦æä¾›äº†JMS
connection的生命周期管ç†çš„功能åQŒä½†æ˜¯æ²¡æœ‰å¯¹æ¶ˆæ¯æŽ¥æ”¶çš„æ–¹å¼ï¼ˆä¸ÕdŠ¨æŽ¥æ”¶æ–¹å¼æˆ–è€…å¼‚æ¥æŽ¥æ”¶æ–¹å¼ï¼‰(j¨ª)½{‰åšä»ÖM½•å‡å®šã€‚该¾cÖM¸»è¦çš„属性如下:(x¨¬)
   clientId通常用于æŒä¹…订阅åQ›sharedConnectionä¿å˜äº†è¢«å…׃ínçš„JMS connectionã€?/p>
Â
   该类定义了如下的抽象æ–ÒŽ(gu¨©)³•åQŒä»¥ä¾¿å¾cÕd¯ä»¥å†³å®šæ˜¯å¦ä‹É用共享的JMS connectionã€?/p>
Â
2.3 AbstractMessageListenerContainer
   AbstractMessageListenerContainer¾l§æ‰¿è‡ªAbstractJmsListeningContaineråQŒä¹Ÿæ˜¯ä½œä¸ºæ‰€æœ‰Message Listener Container的公共基¾c…R€‚该¾cÖM¸»è¦çš„属性如下:(x¨¬)
   destination用于指定接收消æ¯çš„目的地ã€?br />    messageListenerç”¨äºŽæŒ‡å®šå¤„ç†æ¶ˆæ¯çš„listener。对于messageListeneråQŒå®ƒæ—¢å¯ä»¥æ˜¯½W¦åˆJMS规范çš? javax.jms.MessageListeneråQŒä¹Ÿå¯ä»¥æ˜¯Springç‰ÒŽ(gu¨©)œ‰çš? org.springframework.jms.listener.SessionAwareMessageListenerã€? SessionAwareMessageListener的定义如下:(x¨¬)
   跟javax.jms.MessageListener相比åQŒè¿™ä¸ªæŽ¥å£çš„onMessageæ–ÒŽ(gu¨©)³•å¢žåŠ äº†ä¸€ä¸ªSession ¾cÕdž‹çš„傿•ŽÍ¼Œå¯ä»¥é€šè¿‡˜q™ä¸ªsessionå‘é€å›žå¤æ¶ˆæ¯ï¼ˆreply messageåQ‰ã€?/p>
   如果使用了SessionAwareMessageListener ¾cÕdž‹çš„message
listeneråQŒé‚£ä¹ˆexposeListenerSession傿•°æŒ‡å®šäº†ä¼ å…¥onMessageæ–ÒŽ(gu¨©)³•çš„session傿•°æ˜¯å¦æ˜¯åˆ›å»ÞZº†
MessageConsumerçš„sessionåQŒé»˜è®¤å€¼æ˜¯true。如果是falseåQŒé‚£ä¹?
AbstractMessageListenerContainerä¼?x¨¬)在connection上新å»ÞZ¸€ä¸ªsessionåQŒåÆˆä¼ å…¥onMessageæ–ÒŽ(gu¨©)³•ã€?br />
2.4 AbstractPollingMessageListenerContainer
   AbstractPollingMessageListenerContainer¾l§æ‰¿è‡ªAbstractMessageListenerContaineråQŒå®ƒæä¾›äº†å¯¹äºŽä¸»åŠ¨æŽ¥æ”¶æ¶ˆæ?polling)的支æŒï¼Œä»¥åŠ(qi¨¢ng)支æŒå¤–部的事务管ç†ã€?/p>
   如果使用“å‘å¸?è®¢é˜…â€æ¨¡å¼ï¼Œé‚£ä¹ˆpubSubNoLocal 属性指定通过æŸä¸ª˜qžæŽ¥å‘é€åˆ°æŸä¸ªTopic的消æ¯ï¼Œæ˜¯å¦åº”该被投递回˜q™ä¸ª˜qžæŽ¥ã€?/p>
   receiveTimeout属性用于指定调用MessageConsumerçš„receiveæ–ÒŽ(gu¨©)³•æ—¶çš„‘…æ—¶æ—‰™—´åQŒé»˜è®¤å€¼æ˜¯1¿U’ã€‚éœ€è¦æ³¨æ„的是,˜q™ä¸ªå€¼åº”该比transactionManager 䏿Œ‡å®šçš„事务‘…æ—¶æ—‰™—´ç•¥å°ã€?/p>
  Â
通常情况下,应该为transactionManager讄¡½®ä¸€ä¸?
org.springframework.transaction.jta.JtaTransactionManager的实例,æ¤å¤–也è¦è®„¡½®ä¸€ä¸ªæ”¯æŒ?
XAçš„ConnectionFactoryã€‚éœ€è¦æ³¨æ„的是,XA 事务å¯ÒŽ(gu¨©)€§èƒ½æœ‰è¾ƒå¤§çš„å½±å“ã€?br />
Â Â Â å¦‚æžœåªæ˜¯å¸Œæœ›ä½¿ç”¨local JMS
transactionåQŒé‚£ä¹ˆåªè¦è®¾¾|®sessionTransacted为true或者ä‹É用JmsTransactionManagerå›_¯ã€‚实际上åQ?
如果讄¡½®äº†éžJTAçš„transactionManageråQŒé‚£ä¹ˆsessionTransacted属性会(x¨¬)自动被设¾|®æˆtrueã€?br />
   ç”׃ºŽlocal JMS transactionæ— æ³•åŒå…¶å®ƒlocal transactionåQˆä¾‹å¦‚local database
transactionåQ‰è¿›è¡Œåè°ƒï¼Œå› æ¤å®¢æˆ·ç«¯ç¨‹åºå¯èƒ½éœ€è¦å¯¹é‡å‘的消æ¯è¿›è¡Œæ£€æŸ¥ã€‚JMSè§„èŒƒè¦æ±‚åQšJMS
provider应该ž®†é‡å‘消æ¯çš„JMSRedelivered属性设¾|®äØ“(f¨´)trueã€?br />
2.5 SimpleMessageListenerContainer
  Â
SimpleMessageListenerContainer¾l§æ‰¿è‡ªAbstractMessageListenerContaineråQŒä‹Éç”¨å¼‚æ¥æ–¹å¼?
接收消æ¯åQˆä¹Ÿž®±æ˜¯é€šè¿‡MessageConsumer上注册MessageListenerçš„æ–¹å¼æŽ¥æ”¶æ¶ˆæ¯ï¼‰(j¨ª)。该¾cÖM¸»è¦çš„属性如下:(x¨¬)
   如果使用“å‘å¸?è®¢é˜…â€æ¨¡å¼ï¼Œé‚£ä¹ˆpubSubNoLocal 属性指定通过æŸä¸ª˜qžæŽ¥å‘é€åˆ°æŸä¸ªTopic的消æ¯ï¼Œæ˜¯å¦åº”该被投递回˜q™ä¸ª˜qžæŽ¥ã€?/p>
Â
   SimpleMessageListenerContainerå…许创å¾å¤šä¸ªSessionå’ŒMessageConsumeræ¥æŽ¥æ”¶æ¶ˆæ¯ã€‚具体的个数ç”? concurrentConsumerså±žæ€§æŒ‡å®šã€‚éœ€è¦æ³¨æ„çš„æ˜¯ï¼Œåº”è¯¥åªæ˜¯åœ¨Destination为Queue的时候æ‰ä½¿ç”¨å¤šä¸ª MessageConsumeråQˆQueueä¸çš„一个消æ¯åªèƒ½è¢«ä¸€ä¸ªConsumer接收åQ‰ï¼Œè™½ç„¶ä½¿ç”¨å¤šä¸ªMessageConsumerä¼?x¨¬)æé«˜æ¶ˆæ¯å¤„ç? 的性能åQŒä½†æ˜¯æ¶ˆæ¯å¤„ç†çš„™åºåºå´å¾—ä¸åˆ°ä¿è¯åQšæ¶ˆæ¯è¢«æŽ¥æ”¶çš„顺åºä»ç„¶æ˜¯æ¶ˆæ¯å‘逿—¶çš„顺åºï¼Œä½†æ˜¯ç”׃ºŽæ¶ˆæ¯å¯èƒ½ä¼?x¨¬)被òq¶å‘处ç†åQŒå› æ¤æ¶ˆæ¯å¤„ç†çš„™åºåºå¯èƒ½å’Œæ¶ˆæ¯å‘é€çš„ ™åºåºä¸åŒã€‚æ¤å¤–,ä¸åº”该在Destination为Topic的时候ä‹É用多个MessageConsumeråQŒè¿™æ˜¯å› 为多ä¸? MessageConsumerä¼?x¨¬)æŽ¥æ”¶åˆ°åŒæ ·çš„æ¶ˆæ¯ã€?/p>
   SimpleMessageListenerContainer创å¾çš„Sessionå’ŒMessageConsumer分别ä¿å˜åœ¨sessionså’Œconsumers属性ä¸ã€?/p>
  Â
taskExecutor属性的默认值是nullåQŒä¹Ÿž®±æ˜¯è¯ß_(d¨¢)¼Œå¯¹MessageListeneråQˆæˆ–è€?
SessionAwareMessageListeneråQ‰çš„回调是在MessageConsumer的内部线½E‹ä¸æ‰§è¡Œã€‚如果指定了
taskExecutoråQŒé‚£ä¹ˆå›žè°ƒæ˜¯åœ¨TaskExecutor内部的线½E‹ä¸æ‰§è¡Œã€‚以下是相关的代ç :(x¨¬)
Â Â Â éœ€è¦æ³¨æ„的是,如果指定了taskExecutoråQŒé‚£ä¹ˆæ¶ˆæ¯åœ¨è¢«taskExecutor内部的线½E‹å¤„ç†å‰åQŒå¯èƒ½å·²¾l被¼‹®è®¤˜q‡äº†åQˆå¤–层的 onMessageæ–ÒŽ(gu¨©)³•å¯èƒ½å·²ç»æ‰§è¡Œ¾l“æŸäº†ï¼‰(j¨ª)ã€‚å› æ¤å¦‚æžœä‹É用事务Session或者Session.CLIENT_ACKNOWLEDGE¾cÕdž‹çš„确认模 å¼ï¼Œé‚£ä¹ˆå¯èƒ½ä¼?x¨¬)导致问题ã€?/p>
Â
  Â
该类的sharedConnectionEnabledæ–ÒŽ(gu¨©)³•åQˆåœ¨AbstractJmsListeningContainerä¸å®šä¹‰ï¼‰(j¨ª)æ€ÀL˜¯˜q”回trueåQ?
å› æ¤SimpleMessageListenerContainerä¼?x¨¬)ä‹É用共享的JMS connectionã€?br />
2.6 DefaultMessageListenerContainer
  Â
DefaultMessageListenerContainer¾l§æ‰¿è‡?
AbstractPollingMessageListenerContaineråQŒä¸»è¦ä‹Éç”¨åŒæ¥çš„æ–¹å¼æŽ¥æ”¶æ¶ˆæ¯åQˆä¹Ÿž®±æ˜¯é€šè¿‡å¾ªçŽ¯è°ƒç”¨
MessageConsumer.receiveçš„æ–¹å¼æŽ¥æ”¶æ¶ˆæ¯ï¼‰(j¨ª)。该¾cÖM¸»è¦çš„属性如下:(x¨¬)
   跟SimpleMessageListenerContainerä¸€æ øP¼ŒDefaultMessageListenerContainer也支æŒåˆ›å»ºå¤šä¸? Sessionå’ŒMessageConsumeræ¥æŽ¥æ”¶æ¶ˆæ¯ã€‚è·ŸSimpleMessageListenerContainerä¸åŒçš? 是,DefaultMessageListenerContainer创å¾äº†concurrentConsumers所指定个数çš? AsyncMessageListenerInvokeråQˆå®žçŽîCº†SchedulingAwareRunnable接å£åQ‰ï¼Œòq¶äº¤¾l? taskExecutor˜q行ã€?/p>
  Â
maxMessagesPerTask属性的默认值是Integer.MIN_VALUEåQŒä½†æ˜¯å¦‚果设¾|®çš„taskExecutoråQˆé»˜è®¤å€¼æ˜¯
SimpleAsyncTaskExecutoråQ‰å®žçŽîCº†SchedulingTaskExecutor接å£òq¶ä¸”å…?
prefersShortLivedTasksæ–ÒŽ(gu¨©)³•˜q”回trueåQˆä¹Ÿž®±æ˜¯è¯´è¯¥TaskExecutorå€‘Ö‘äºŽçŸæœŸä“Q务)(j¨ª)åQŒé‚£ä¹?
maxMessagesPerTask属性会(x¨¬)自动被设¾|®äØ“(f¨´)10ã€?br />
  Â
如果maxMessagesPerTask属性的值å°äº?åQŒé‚£ä¹ˆAsyncMessageListenerInvoker.runæ–ÒŽ(gu¨©)³•ä¼?x¨¬)在循环ä¸åå¤å°è?
接收消æ¯åQŒåƈ在接收到消æ¯åŽè°ƒç”¨MessageListeneråQˆæˆ–者SessionAwareMessageListeneråQ‰ï¼›å¦‚æžœ
maxMessagesPerTask属性的å€ég¸ž®äºŽ0åQŒé‚£ä¹ˆAsyncMessageListenerInvoker.runæ–ÒŽ(gu¨©)³•里最多会(x¨¬)ž®è¯•接收消æ¯
maxMessagesPerTask‹Æ¡ï¼Œæ¯æ¬¡æŽ¥æ”¶æ¶ˆæ¯çš„超时时间由其父¾c?
AbstractPollingMessageListenerContainerçš„receiveTimeout属性指定。如果在˜q™äº›ž®è¯•ä¸éƒ½æ²¡æœ‰æŽ¥æ”¶
到消æ¯ï¼Œé‚£ä¹ˆAsyncMessageListenerInvokerçš„idleTaskExecutionCount属性会(x¨¬)被ç¯åŠ ã€‚åœ¨runæ–ÒŽ(gu¨©)³•执行å®?
毕å‰ä¼?x¨¬)对idleTaskExecutionCount˜q›è¡Œ‹‚€(g¨¨)æŸ¥ï¼Œå¦‚æžœè¯¥å€ÆD¶…˜q‡äº†
DefaultMessageListenerContainer.idleTaskExecutionLimitåQˆé»˜è®¤å€?åQ‰ï¼Œé‚£ä¹ˆ˜q™ä¸ª
AsyncMessageListenerInvokerå¯èƒ½ä¼?x¨¬)被销æ¯ã€?/p>
  Â
所有AsyncMessageListenerInvoker实例都ä¿å˜åœ¨scheduledInvokersä¸ï¼Œå®žä¾‹çš„个数å¯ä»¥åœ¨
concurrentConsumerså’ŒmaxConcurrentConsumers之间‹¹®åŠ¨ã€‚è·Ÿ
SimpleMessageListenerContainerä¸€æ øP¼Œåº”è¯¥åªæ˜¯åœ¨Destination为Queue的时候æ‰ä½¿ç”¨å¤šä¸ª
AsyncMessageListenerInvoker实例�/p>
Â
   cacheLevel属性用于指定是å¦å¯¹JMS资溘q›è¡Œ¾~“å˜åQŒå¯é€‰çš„值是CACHE_NONE = 0ã€CACHE_CONNECTION = 1ã€CACHE_SESSION = 2ã€CACHE_CONSUMER = 3å’ŒCACHE_AUTO = 4。默认情况下åQŒå¦‚æžœtransactionManager属性ä¸ä¸ºnullåQŒé‚£ä¹ˆcacheLevel被自动设¾|®äØ“(f¨´)CACHE_NONEåQˆä¸˜q›è¡Œ¾~? å˜ï¼‰(j¨ª)åQŒå¦åˆ™cacheLevel被自动设¾|®äØ“(f¨´)CACHE_CONSUMERã€?/p>
   如果cacheLevel属性值大于ç‰äºŽCACHE_CONNECTIONåQŒé‚£ä¹ˆsharedConnectionEnabledæ–ÒŽ(gu¨©)³•åQˆåœ¨AbstractJmsListeningContainerä¸å®šä¹‰ï¼‰(j¨ª)˜q”回trueåQŒä¹Ÿž®±æ˜¯è¯´ä‹É用共享的JMS˜qžæŽ¥ã€?/p>
Â
Â
3 SingleConnectionFactory
  Â
SingleConnectionFactory实现了ConnectionFactory接å£åQŒå…¶createConnectionæ–ÒŽ(gu¨©)³•æ€ÀL˜¯˜q”回相åŒçš?
Connection。å¯ä»¥åœ¨SingleConnectionFactoryçš„æž„é€ å‡½æ•îC¸ä¼ å…¥Connection对象或è€?
ConnectionFactory对象åQŒç”¨æ¥åˆ›å»ø™¢«ä»£ç†çš„连接对象ã€?
SingleConnectionFactory.createConnectionæ–ÒŽ(gu¨©)³•˜q”回的连接是个代ç†ï¼Œå®ƒå¿½ç•¥äº†å¯¹stopå’Œcloseæ–ÒŽ(gu¨©)³•的调ç”?
åQˆè¿žæŽ¥ä¼š(x¨¬)在SingleConnectionFactory.destroyæ–ÒŽ(gu¨©)³•ä¸å…³é—)(j¨ª)ã€?/p>
   SingleConnectionFactoryçš„reconnectOnExceptionå±žæ€§ç”¨æ¥æŒ‡å®šæ˜¯å¦åœ¨˜qžæŽ¥æŠ›å‡ºJMSException的时候,对连接进行釾|®ï¼Œé‡ç½®åŽå¦‚æžœå†è°ƒç”¨createConnectionæ–ÒŽ(gu¨©)³•åQŒé‚£ä¹ˆä¼š(x¨¬)˜q”回一个新的连接ã€?/p>
  Â
éœ€è¦æ³¨æ„的是,AbstractJmsListeningContainer¾cÈš„抽象æ–ÒŽ(gu¨©)³•sharedConnectionEnabled指定了是å¦åœ¨
message listener container内部使用å…׃ínçš„JMS˜qžæŽ¥ã€‚å› æ¤é€šå¸¸æƒ…况下ä¸éœ€è¦äØ“(f¨´)å•独的message listener
container讄¡½®SingleConnectionFactoryåQˆåŠ(qi¨¢ng)å…¶å¾c»ï¼‰(j¨ª)åQ›å¦‚果希望在ä¸åŒçš„message listener
container之间å…׃ínJMS˜qžæŽ¥åQŒé‚£ä¹ˆå¯ä»¥è€ƒè™‘使用SingleConnectionFactoryã€?br />
3.1 CachingConnectionFactory
   CachingConnectionFactory¾l§æ‰¿è‡ªSingleConnectionFactoryåQŒå¢žåŠ äº†å¯¹Sessionå’ŒMessageProducer¾~“å˜çš„功能。该¾cÖM¸»è¦çš„属性如下:(x¨¬)
   sessionCacheSize属性指定了被缓å˜çš„Session实例的个敎ͼˆé»˜è®¤å€¼æ˜¯1åQ‰ï¼Œä¹Ÿå°±æ˜¯è¯´åQŒå¦‚æžœåŒæ—¶è¯·æ±‚çš„Session个数大于sessionCacheSizeåQŒé‚£ä¹ˆè¿™äº›Sessionä¸ä¼š(x¨¬)被缓å˜ï¼Œè€Œæ˜¯æ£å¸¸çš„被创å¾å’Œé”€æ¯ã€?/p>
   cacheProducers属性指定了是å¦å¯¹MessageProducer˜q›è¡Œ¾~“å˜åQŒé»˜è®¤å€¼æ˜¯trueã€?/p>
å—æ®µ | å…许å€?/th> | å…许的特ŒDŠå—½W?/th> | ||
---|---|---|---|---|
¿U?/code> |
0-59 |
, - * / |
||
�/code> |
0-59 |
, - * / |
||
ž®æ—¶ |
0-23 |
, - * / |
||
日期 |
1-31 |
, - * ? / L W C |
||
月䆾 |
1-12 或�JAN-DEC |
, - * / |
||
星期 |
1-7 或�SUN-SAT |
, - * ? / L C # |
||
òqß_(d¨¢)¼ˆå¯é€‰ï¼‰(j¨ª) |
留空, 1970-2099 |
, - * / |
å—æ®µ | å…许å€?/th> | å…许的特ŒDŠå—½W?/th> | ||
---|---|---|---|---|
¿U?/code>
|
0-59
|
, - * /
|
||
�/code>
|
0-59
|
, - * /
|
||
ž®æ—¶
|
0-23
|
, - * /
|
||
日期
|
1-31
|
, - * ? / L W C
|
||
月䆾
|
1-12 或�JAN-DEC
|
, - * /
|
||
星期
|
1-7 或�SUN-SAT
|
, - * ? / L C #
|
||
òqß_(d¨¢)¼ˆå¯é€‰ï¼‰(j¨ª)
|
留空, 1970-2099
|
, - * /
|
The '*' character is used to specify all values. For example, "*" in the minute field means "every minute".
“*”å—ç¬¦è¢«ç”¨æ¥æŒ‡å®šæ‰€æœ‰çš„倹{€‚如åQ?#8221;*“åœ¨åˆ†é’Ÿçš„å—æ®µåŸŸé‡Œè¡¨ç¤º“æ¯åˆ†é’?#8221;ã€?
The
'?' character is allowed for the day-of-month and day-of-week fields.
It is used to specify 'no specific value'. This is useful when you need
to specify something in one of the two fileds, but not the other. See
the examples below for clarification.
“?”å—符åªåœ¨æ—¥æœŸåŸŸå’Œæ˜ŸæœŸåŸŸä¸ä½¿ç”¨ã€‚å®ƒè¢«ç”¨æ¥æŒ‡å®?#8220;éžæ˜Ž¼‹®çš„å€?#8221;ã€‚å½“ä½ éœ€è¦é€šè¿‡åœ¨è¿™ä¸¤ä¸ªåŸŸä¸çš„ä¸€ä¸ªæ¥æŒ‡å®šä¸€äº›ä¸œè¥¿çš„æ—¶å€™ï¼Œå®ƒæ˜¯æœ‰ç”¨çš„。看下é¢çš„例åä½ ž®×ƒ¼š(x¨¬)明白ã€?
月䆾ä¸çš„æ—¥æœŸå’Œæ˜ŸæœŸä¸çš„æ—¥æœŸè¿™ä¸¤ä¸ªå…ƒç´ 时互斥的一起应该通过讄¡½®ä¸€ä¸ªé—®å??)æ¥è¡¨æ˜Žä¸æƒŒ™®¾¾|®é‚£ä¸ªå—ŒD?br />
The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12".
“-”å—ç¬¦è¢«ç”¨æ¥æŒ‡å®šä¸€ä¸ªèŒƒå›´ã€‚如åQ?#8220;10-12”åœ¨å°æ—¶åŸŸæ„味瀓10ç‚V€?1ç‚V€?2ç‚?#8221;ã€?
The
',' character is used to specify additional values. For example
"MON,WED,FRI" in the day-of-week field means "the days Monday,
Wednesday, and Friday".
“,”å—ç¬¦è¢«ç”¨æ¥æŒ‡å®šå¦å¤–的倹{€‚如åQ?#8220;MON,WED,FRI”在星期域里表½C?#8221;æ˜ŸæœŸä¸€ã€æ˜ŸæœŸä¸‰ã€æ˜ŸæœŸäº””.
The
'/' character is used to specify increments. For example "0/15" in the
seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in the
seconds field means "the seconds 5, 20, 35, and 50". Specifying '*'
before the '/' is equivalent to specifying 0 is the value to start
with. Essentially, for each field in the expression, there is a set of
numbers that can be turned on or off. For seconds and minutes, the
numbers range from 0 to 59. For hours 0 to 23, for days of the month 0
to 31, and for months 1 to 12. The "/" character simply helps you turn
on every "nth" value in the given set. Thus "7/6" in the month field
only turns on month "7", it does NOT mean every 6th month, please note
that subtlety.
The 'L' character is allowed for the
day-of-month and day-of-week fields. This character is short-hand for
"last", but it has different meaning in each of the two fields. For
example, the value "L" in the day-of-month field means "the last day of
the month" - day 31 for January, day 28 for February on non-leap years.
If used in the day-of-week field by itself, it simply means "7" or
"SAT". But if used in the day-of-week field after another value, it
means "the last xxx day of the month" - for example "6L" means "the
last friday of the month". When using the 'L' option, it is important
not to specify lists, or ranges of values, as you'll get confusing
results.
Læ˜?#8216;last’çš„çœç•¥å†™æ³•å¯ä»¥è¡¨½Cºday-of-monthå’Œday-of-weekåŸŸï¼Œä½†åœ¨ä¸¤ä¸ªå—æ®µä¸çš„æ„æ€ä¸åŒï¼Œä¾‹å¦‚day-of-month域ä¸è¡¨ç¤ºä¸€ä¸ªæœˆçš„æœ€åŽä¸€å¤©ï¼Œ
如果在day-of-week域表½C?#8216;7’或è€?#8216;SAT’åQŒå¦‚果在day-of-week域ä¸å‰é¢åŠ ä¸Šæ•°å—åQŒå®ƒè¡¨ç¤ºä¸€ä¸ªæœˆçš„æœ€åŽå‡ 天,例如‘6L’ž®Þp¡¨½CÞZ¸€ä¸ªæœˆçš„æœ€åŽä¸€ä¸?br />
星期五,
The
'W' character is allowed for the day-of-month field. This character is
used to specify the weekday (Monday-Friday) nearest the given day. As
an example, if you were to specify "15W" as the value for the
day-of-month field, the meaning is: "the nearest weekday to the 15th of
the month". So if the 15th is a Saturday, the trigger will fire on
Friday the 14th. If the 15th is a Sunday, the trigger will fire on
Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday
the 15th. However if you specify "1W" as the value for day-of-month,
and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as
it will not 'jump' over the boundary of a month's days. The 'W'
character can only be specified when the day-of-month is a single day,
not a range or list of days
.
The 'L' and 'W' characters can
also be combined for the day-of-month expression to yield 'LW', which
translates to "last weekday of the month".
The '#' character
is allowed for the day-of-week field. This character is used to specify
"the nth" XXX day of the month. For example, the value of "6#3" in the
day-of-week field means the third Friday of the month (day 6 = Friday
and "#3" = the 3rd one in the month). Other examples: "2#1" = the first
Monday of the month and "4#5" = the fifth Wednesday of the month. Note
that if you specify "#5" and there is not 5 of the given day-of-week in
the month, then no firing will occur that month.
The 'C'
character is allowed for the day-of-month and day-of-week fields. This
character is short-hand for "calendar". This means values are
calculated against the associated calendar, if any. If no calendar is
associated, then it is equivalent to having an all-inclusive calendar.
A value of "5C" in the day-of-month field means "the first day included
by the calendar on or after the 5th". A value of "1C" in the
day-of-week field means "the first day included by the calendar on or
after sunday".
关于cronExpression的介¾l?
å—æ®µ å…许å€?å…许的特ŒDŠå—½W?
¿U?0-59 , - * /
�0-59 , - * /
ž®æ—¶ 0-23 , - * /
日期 1-31 , - * ? / L W C
月䆾 1-12 或�JAN-DEC , - * /
星期 1-7 或�SUN-SAT , - * ? / L C #
òqß_(d¨¢)¼ˆå¯é€‰ï¼‰(j¨ª) 留空, 1970-2099 , - * /
è¡¨è¾¾å¼æ„ä¹?
"0 0 12 * * ?" æ¯å¤©ä¸åˆ12点触å?
"0 15 10 ? * *" æ¯å¤©ä¸Šåˆ10:15触å‘
"0 15 10 * * ?" æ¯å¤©ä¸Šåˆ10:15触å‘
"0 15 10 * * ? *" æ¯å¤©ä¸Šåˆ10:15触å‘
"0 15 10 * * ? 2005" 2005òq´çš„æ¯å¤©ä¸Šåˆ10:15触å‘
"0 * 14 * * ?" 在æ¯å¤©ä¸‹å?点到下åˆ2:59期间的æ¯1分钟触å‘
"0 0/5 14 * * ?" 在æ¯å¤©ä¸‹å?点到下åˆ2:55期间的æ¯5分钟触å‘
"0 0/5 14,18 * * ?" 在æ¯å¤©ä¸‹å?点到2:55期间和下å?点到6:55期间的æ¯5分钟触å‘
"0 0-5 14 * * ?" 在æ¯å¤©ä¸‹å?点到下åˆ2:05期间的æ¯1分钟触å‘
"0 10,44 14 ? 3 WED" æ¯å¹´ä¸‰æœˆçš„æ˜ŸæœŸä¸‰çš„下å?:10å’?:44触å‘
"0 15 10 ? * MON-FRI" 周一臛_‘¨äº”的上åˆ10:15触å‘
"0 15 10 15 * ?" æ¯æœˆ15日上å?0:15触å‘
"0 15 10 L * ?" æ¯æœˆæœ€åŽä¸€æ—¥çš„上åˆ10:15触å‘
"0 15 10 ? * 6L" æ¯æœˆçš„æœ€åŽä¸€ä¸ªæ˜ŸæœŸäº”上åˆ10:15触å‘
"0 15 10 ? * 6L 2002-2005" 2002òq´è‡³2005òq´çš„æ¯æœˆçš„æœ€åŽä¸€ä¸ªæ˜ŸæœŸäº”上åˆ10:15触å‘
"0 15 10 ? * 6#3" æ¯æœˆçš„第三个星期五上å?0:15触å‘
æ¯å¤©æ—©ä¸Š6ç‚?
0 6 * * *
æ¯ä¸¤ä¸ªå°æ—?
0 */2 * * *
晚上11点到早上8点之间æ¯ä¸¤ä¸ªž®æ—¶åQŒæ—©ä¸Šå…«ç‚?
0 23-7/2åQ? * * *
æ¯ä¸ªæœˆçš„4å·å’Œæ¯ä¸ª½C¼æ‹œçš„礼拜一到礼拜三的早ä¸?1ç‚?
0 11 4 * 1-3
1�日早��
0 4 1 1 *
quartz的高¾U§ç‰¹æ€§ä¸ä»…如æ?
1 æ•°æ®åº“å˜å‚?
2 集群支æŒ
3 æ•°æ®åº“æŒä¹…化ä»ÕdŠ¡åQŒtrigger
4 trigger çš„åœæ¢ï¼Œ˜q行
5 ä»ÕdŠ¡çš„ä“Qæ„æ·»åŠ?
6 比corntrigger 更详ž®½çš„ä»ÕdŠ¡å®‰æŽ’
7 ¾U¿ç¨‹çš„内部数æ®äº¤æ?/p>