blob: 1f5335dd274fdba80249bc60cd12a19c38e71b36 [file] [log] [blame]
<div class="wiki-content maincontent"><p>The TimeStampPlugin is a Broker interceptor which updates a JMS Client's time stamp on the message with a broker time stamp. This can be useful when the clocks on client machines are known to not be correct and you can only trust the time set on the broker machines.</p><p>Enabling this plugin will break JMS compliance since the time stamp that the producer sees on the messages after as&#160;<strong><code>send()</code></strong> will be different from the time stamp the consumer will observe when he receives the message.</p><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body">By default this plugin is <em>not</em> enabled in ActiveMQ.</div></div><h4 id="TimeStampPlugin-Options">Options</h4><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p><strong>Attribute</strong></p></th><th colspan="1" rowspan="1" class="confluenceTh"><p><strong>Default Value</strong></p></th><th colspan="1" rowspan="1" class="confluenceTh"><p><strong>Description</strong></p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>futureOnly</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>When <strong><code>true</code></strong> the plugin will <em>never</em> set a message's time stamp and expiration time to a value lower than the original values.</p><p>When <strong><code>false</code></strong> the plugin&#160;<em>always</em> update a message's time stamp and expiration time.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ttlCeiling</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>When not zero, this value (in ms) limit the expiration time.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>zeroExpirationOverride</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>When not zero this value (in ms) will override the expiration time for messages that do not have an expiration already set.</p></td></tr></tbody></table></div><p>To enable the TimeStampPlugin add the following to your ActiveMQ Broker configuration.</p><p>Example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;plugins&gt;
&lt;!-- 86,400,000 ms = 1 day --&gt;
&lt;timeStampingBrokerPlugin ttlCeiling="86400000" zeroExpirationOverride="86400000"/&gt;
&lt;/plugins&gt;
</pre>
</div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title"> Broker/Consumer Clock Synchronization</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When the consumer&#8217;s local clock is running ahead of the broker&#8217;s local clock then messages might not be consumed by your consumer when this plug-in is loaded with default configuration as the consumer could perceive the messages as already expired.</p><p>If the clock difference between broker and consumer is <em>greater than</em> the message expiration time <em>and</em> if the consumer&#8217;s clock is running ahead, then set <strong><code>futureOnly="true"</code></strong>.</p><p>See the following <a shape="rect" class="external-link" href="http://tmielke.blogspot.com/2011/01/sync-your-machine-clocks.html" rel="nofollow">blog post</a> for more details.</p></div></div></div>