You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "niwa.sama" <ni...@gmail.com> on 2017/06/20 22:36:53 UTC

When are messageConsumed, messagePull and messageDelivered methods of BrokerFilter executed?

I am developing a plugin to control the number of messages that AMQ can
handle in a fix time, but, i don't know when the mentioned methods are
executed. I run many tests, but in none i can see that the methods are
executed. Can any one please explain to me if i need some special
configuration in AMQ in order to used that methods in my plugin?

I am using xbean to generate a custom XML for my plugin.

This is the configuration in my AMQ:

<broker xmlns="http://activemq.apache.org/schema/core"
brokerName="instance-1" dataDirectory="${activemq.data}"
schedulerSupport="true">
    <destinationPolicy>
        <policyMap>
          <policyEntries>
            <policyEntry topic="&gt;">
                <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                </pendingMessageLimitStrategy>
            </policyEntry>
            <policyEntry memoryLimit="100mb" producerFlowControl="false"
queue="&gt;" prioritizedMessages="true" useCache="false">
                <deadLetterStrategy>
                    <individualDeadLetterStrategy queuePrefix="DLQ." />
                </deadLetterStrategy>
                <pendingQueuePolicy>
                    <storeCursor/>
                </pendingQueuePolicy>
            </policyEntry>
          </policyEntries>
        </policyMap>
    </destinationPolicy>

    <plugins>
        <transactionsPlugin xmlns="http://commons.cm.com/schema/activemq">
            <transactionsPolicies>
                <transactionsPolicy queue="jms.test.queue"
transactions="10"/>
            </transactionsPolicies>
        </transactionsPlugin>
    </plugins>

    <managementContext>
        <managementContext createConnector="false"/>
    </managementContext>

    <persistenceAdapter>
        <kahaDB directory="${activemq.data}/kahadb"/>
    </persistenceAdapter>


      <systemUsage>
        <systemUsage>
            <memoryUsage>
                <memoryUsage percentOfJvmHeap="70"/>
            </memoryUsage>
            <storeUsage>
                <storeUsage limit="100 gb"/>
            </storeUsage>
            <tempUsage>
                <tempUsage limit="50 gb"/>
            </tempUsage>
        </systemUsage>
    </systemUsage>

    <networkConnectors>
        <networkConnector name="instance-2"
uri="static:(tcp://127.0.0.1:62616)" conduitSubscriptions="true"
userName="admin" password="admin"/>
    </networkConnectors>

    <transportConnectors>
        <transportConnector name="openwire"
uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"
updateClusterClients="true" rebalanceClusterClients="true"
updateClusterClientsOnRemove="true"/>
    </transportConnectors>

    <shutdownHooks>
        <bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.activemq.hooks.SpringContextHook"/>
    </shutdownHooks>
</broker>

I have tow Brokers configured in the same machine. Of course, only the
brokerName and networkConnector it's different.



--
View this message in context: http://activemq.2283324.n4.nabble.com/When-are-messageConsumed-messagePull-and-messageDelivered-methods-of-BrokerFilter-executed-tp4727593.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: When are messageConsumed, messagePull and messageDelivered methods of BrokerFilter executed?

Posted by Timothy Bish <ta...@gmail.com>.
On 06/21/2017 12:05 PM, niwa.sama wrote:
> Hi
>
> I have another question and i hope that you can help me.
>
> I need to interrupt the process and re-apply the interceptor to one message
> (or may be create and send a new message with same data) in some point of
> the process (for example in preProcessDispatch method) if that message have
> setted some properties, do exists a way to do that?
>
> In both cases: re-apply the interceptor or create and send a new message, it
> is necessary to interrupt the current process.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/When-are-messageConsumed-messagePull-and-messageDelivered-methods-of-BrokerFilter-executed-tp4727593p4727670.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Have you looked at the Camel Broker component? 
http://activemq.apache.org/broker-camel-component.html

-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: When are messageConsumed, messagePull and messageDelivered methods of BrokerFilter executed?

Posted by "niwa.sama" <ni...@gmail.com>.
Hi

I have another question and i hope that you can help me.

I need to interrupt the process and re-apply the interceptor to one message
(or may be create and send a new message with same data) in some point of
the process (for example in preProcessDispatch method) if that message have
setted some properties, do exists a way to do that?

In both cases: re-apply the interceptor or create and send a new message, it
is necessary to interrupt the current process.



--
View this message in context: http://activemq.2283324.n4.nabble.com/When-are-messageConsumed-messagePull-and-messageDelivered-methods-of-BrokerFilter-executed-tp4727593p4727670.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: When are messageConsumed, messagePull and messageDelivered methods of BrokerFilter executed?

Posted by Timothy Bish <ta...@gmail.com>.
On Tue, Jun 20, 2017 at 6:36 PM, niwa.sama <ni...@gmail.com> wrote:

> I am developing a plugin to control the number of messages that AMQ can
> handle in a fix time, but, i don't know when the mentioned methods are
> executed. I run many tests, but in none i can see that the methods are
> executed. Can any one please explain to me if i need some special
> configuration in AMQ in order to used that methods in my plugin?
>
>
For the consumed and delivered you need to enable the support for sending
the advisory messages that are sent on those events
http://activemq.apache.org/advisory-message.html

For messagePull you'd need a zero prefetch consumer connected that is
pulling messages.


I am using xbean to generate a custom XML for my plugin.
>
> This is the configuration in my AMQ:
>
> <broker xmlns="http://activemq.apache.org/schema/core"
> brokerName="instance-1" dataDirectory="${activemq.data}"
> schedulerSupport="true">
>     <destinationPolicy>
>         <policyMap>
>           <policyEntries>
>             <policyEntry topic="&gt;">
>                 <pendingMessageLimitStrategy>
>                     <constantPendingMessageLimitStrategy limit="1000"/>
>                 </pendingMessageLimitStrategy>
>             </policyEntry>
>             <policyEntry memoryLimit="100mb" producerFlowControl="false"
> queue="&gt;" prioritizedMessages="true" useCache="false">
>                 <deadLetterStrategy>
>                     <individualDeadLetterStrategy queuePrefix="DLQ." />
>                 </deadLetterStrategy>
>                 <pendingQueuePolicy>
>                     <storeCursor/>
>                 </pendingQueuePolicy>
>             </policyEntry>
>           </policyEntries>
>         </policyMap>
>     </destinationPolicy>
>
>     <plugins>
>         <transactionsPlugin xmlns="http://commons.cm.com/schema/activemq">
>             <transactionsPolicies>
>                 <transactionsPolicy queue="jms.test.queue"
> transactions="10"/>
>             </transactionsPolicies>
>         </transactionsPlugin>
>     </plugins>
>
>     <managementContext>
>         <managementContext createConnector="false"/>
>     </managementContext>
>
>     <persistenceAdapter>
>         <kahaDB directory="${activemq.data}/kahadb"/>
>     </persistenceAdapter>
>
>
>       <systemUsage>
>         <systemUsage>
>             <memoryUsage>
>                 <memoryUsage percentOfJvmHeap="70"/>
>             </memoryUsage>
>             <storeUsage>
>                 <storeUsage limit="100 gb"/>
>             </storeUsage>
>             <tempUsage>
>                 <tempUsage limit="50 gb"/>
>             </tempUsage>
>         </systemUsage>
>     </systemUsage>
>
>     <networkConnectors>
>         <networkConnector name="instance-2"
> uri="static:(tcp://127.0.0.1:62616)" conduitSubscriptions="true"
> userName="admin" password="admin"/>
>     </networkConnectors>
>
>     <transportConnectors>
>         <transportConnector name="openwire"
> uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;
> wireFormat.maxFrameSize=104857600"
> updateClusterClients="true" rebalanceClusterClients="true"
> updateClusterClientsOnRemove="true"/>
>     </transportConnectors>
>
>     <shutdownHooks>
>         <bean xmlns="http://www.springframework.org/schema/beans"
> class="org.apache.activemq.hooks.SpringContextHook"/>
>     </shutdownHooks>
> </broker>
>
> I have tow Brokers configured in the same machine. Of course, only the
> brokerName and networkConnector it's different.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/When-are-messageConsumed-messagePull-
> and-messageDelivered-methods-of-BrokerFilter-executed-tp4727593.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
--
Tim Bish