activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: spec violation(?)-Temporary queue creation based on name
Date Tue, 24 Jun 2008 15:53:38 GMT
How does that violate the spec - when you are using non JMS API's to  
get that info ?

On 24 Jun 2008, at 16:34, Filip Hanik - Dev Lists wrote:

> The fix to
> http://issues.apache.org/activemq/browse/AMQ-1142
>
> in revision:
> http://svn.apache.org/viewvc?view=rev&revision=546476
>
> causes the queue or topic creation to use the name to determine if  
> it is supposed to be temporary or not, ignoring the call the client  
> is making.
>
> This simple test case
>
> String connectionId =  
> connection.getConnectionInfo().getConnectionId().toString();
> topic = session.createTopic(connectionId);
>
> returns a temporary topic, even though the API call was explicit it  
> didn't want a temp topic.
>
> I would say that this must violate the spec, that a temp queue is  
> created when using an explicit API call to to create a regular one.
>
> A quick fix would be to simply allow a system property to control  
> the behavior (as seen below), but I will take a deeper look into  
> 1142, and see if I can understand why this behavior was put into the  
> session
>
> Filip
>
>
> Index: activemq-core/src/main/java/org/apache/activemq/ 
> ActiveMQSession.java
> ===================================================================
> --- activemq-core/src/main/java/org/apache/activemq/ 
> ActiveMQSession.java        (revision 669337)
> +++ activemq-core/src/main/java/org/apache/activemq/ 
> ActiveMQSession.java        (working copy)
> @@ -141,6 +141,9 @@
>        */
>       public static final int INDIVIDUAL_ACKNOWLEDGE=4;
>
> +    public static final boolean STRICT_DESTINATION_CREATION =
> +        
> Boolean 
> .getBoolean 
> (System 
> .getProperty("org.apache.activemq.STRICT_DESTINATION_CREATION",  
> "false"));
> +
>    public static interface DeliveryListener {
>        void beforeDelivery(ActiveMQSession session, Message msg);
>
> @@ -1040,7 +1043,7 @@
>     */
>    public Queue createQueue(String queueName) throws JMSException {
>        checkClosed();
> -        if  
> (queueName 
> .startsWith(ActiveMQDestination.TEMP_DESTINATION_NAME_PREFIX)) {
> +        if  
> (queueName 
> .startsWith(ActiveMQDestination.TEMP_DESTINATION_NAME_PREFIX) && (! 
> STRICT_DESTINATION_CREATION)) {
>
>            return new ActiveMQTempQueue(queueName);
>        }
>        return new ActiveMQQueue(queueName);
> @@ -1066,9 +1069,11 @@
>     *                 internal error.
>     * @since 1.1
>     */
> +
> +
>    public Topic createTopic(String topicName) throws JMSException {
>        checkClosed();
> -        if  
> (topicName 
> .startsWith(ActiveMQDestination.TEMP_DESTINATION_NAME_PREFIX)) {
> +        if  
> (topicName 
> .startsWith(ActiveMQDestination.TEMP_DESTINATION_NAME_PREFIX) && (! 
> STRICT_DESTINATION_CREATION)) {
>
>            return new ActiveMQTempTopic(topicName);
>        }
>        return new ActiveMQTopic(topicName);
>


Mime
View raw message