You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Leonardo K. Shikida" <sh...@gmail.com> on 2013/11/19 14:22:24 UTC

setting priority

Hi

I am trying this code

            log.debug(this+" : Creating Connection for "+op.name());
            ConnectionFactory connectionFactory =
this.baseService.getConnectionFactory();
            connection = connectionFactory.createConnection();
            connection.start();

            log.debug(this+" : Creating Session for "+op.name());
            session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
            Queue queue = this.baseService.getTimerCmdQueue();
            MessageProducer producer = session.createProducer(queue);
//            producer.setDeliveryMode(DeliveryMode.PERSISTENT);

            log.debug(this+" : Creating Message for "+op.name());
            Message message = session.createMessage();

//            producer.setPriority(9);//highest
            log.debug(this+" : Sending Message for "+op.name());
//            producer.send(message);
            producer.send(message,DeliveryMode.PERSISTENT,9,0);
            log.debug(this+" : Message Sent for "+op.name());

but messages appear in ACTIVEMQ_MSGS with priority 0.

is this the expected behavior? I am using TomEE 1.5.2

activemq-core.jar says

Manifest-Version: 1.0
Bnd-LastModified: 1349192683077
Build-Jdk: 1.6.0_33
Built-By: dejanb
Bundle-Activator: org.apache.activemq.util.osgi.Activator
Bundle-Description: The ActiveMQ Message Broker and Client implementatio
 ns
Bundle-DocURL: http://www.apache.org/
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-ManifestVersion: 2
Bundle-Name: activemq-core
Bundle-SymbolicName: org.apache.activemq.activemq-core
Bundle-Vendor: The Apache Software Foundation
Bundle-Version: 5.7.0
Created-By: Apache Maven Bundle Plugin

activemq.xml says

<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- Allows us to use system properties as variables in this
configuration file -->
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.conf}/credentials.properties</value>
        </property>
    </bean>
    <broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.data}">
        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry
                    queue=">"
                    producerFlowControl="false"
                    prioritizedMessages="true"
                    useCache="false"
                    expireMessagesPeriod="0"
                    queuePrefetch="1"/>
                    <pendingQueuePolicy>
                        <vmQueueCursor />
                    </pendingQueuePolicy>
              </policyEntries>
            </policyMap>
        </destinationPolicy>
    </broker>
</beans>

TIA

Leo