You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Jonathan Robie <jo...@redhat.com> on 2009/09/30 14:15:07 UTC

[Fwd: Re: can't config a fanout exchange]

Hmmm, the markup in the "wrong" configuration file is a lot more 
straightforward.

I find it confusing to use the name of the exchange is used as both data 
and metadata (element content and the name of an element).

Jonathan

Re: [Fwd: Re: can't config a fanout exchange]

Posted by Jonathan Robie <jo...@redhat.com>.
Martin Ritchie wrote:
>  Having configuration that is useable by both would be a good goal for 
> the project.

That would be useful for people who want to be able to swap out servers, 
and would simplify testing.

How much interest is there in this?

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: [Fwd: Re: can't config a fanout exchange]

Posted by Jonathan Robie <jo...@redhat.com>.
Martin Ritchie wrote:
>> I agree that it's a particularly unlovely way of using XML...  however I
>> would rather fix config more generally and do it once, rather than breaking
>> it for people twice
>>     
>
> +1, I'm all for fixing it once. Hence why I thought it would be good
> to have some discussion about what that final format might be.
> Ensuring compatibility between all Qpid Brokers would be top of my
> list.
>   

Compatible configuration files becomes more compelling once the brokers 
actually support the same AMQP protocol ....

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: [Fwd: Re: can't config a fanout exchange]

Posted by Martin Ritchie <ri...@apache.org>.
2009/10/1 Robert Godfrey <ro...@gmail.com>:
> 2009/10/1 Jonathan Robie <jo...@redhat.com>
>
>> Robert Godfrey wrote:
>>
>>> The fundamental problem (IMHO) is that queue and exchange configuration is
>>> ill-suited to being in a hand editable config file.  My understanding is
>>> that the C++ broker stores this info in a database and you use tools to
>>> manage it.
>>>
>>>
>>
>> I think there are advantages to a human-readable representation that is
>> easily exchanged and easily changed. I think that file could be designed
>> better, either in XML or in some other format (e.g. Google Protocol
>> Buffers).
>>
>>  Anyway - for the moment I suggest we just make queue and exchange
>>> consistent(ly ugly) ... pending a more thorough fixing of the Java Broker
>>> configuration...
>>>
>>>
>>
>> My vote would be to use names as data, not as metadata, in the short term
>> fix ;->
>>
>
> Well - given that the Queue configuration works...we have lots of people
> using it... etc... I'm less inclined to change that than to change the
> configuration which is broken and no-one uses :-)
>
> I agree that it's a particularly unlovely way of using XML...  however I
> would rather fix config more generally and do it once, rather than breaking
> it for people twice

+1, I'm all for fixing it once. Hence why I thought it would be good
to have some discussion about what that final format might be.
Ensuring compatibility between all Qpid Brokers would be top of my
list.

Martin

> -- Rob
>



-- 
Martin Ritchie

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: [Fwd: Re: can't config a fanout exchange]

Posted by Robert Godfrey <ro...@gmail.com>.
2009/10/1 Jonathan Robie <jo...@redhat.com>

> Robert Godfrey wrote:
>
>> The fundamental problem (IMHO) is that queue and exchange configuration is
>> ill-suited to being in a hand editable config file.  My understanding is
>> that the C++ broker stores this info in a database and you use tools to
>> manage it.
>>
>>
>
> I think there are advantages to a human-readable representation that is
> easily exchanged and easily changed. I think that file could be designed
> better, either in XML or in some other format (e.g. Google Protocol
> Buffers).
>
>  Anyway - for the moment I suggest we just make queue and exchange
>> consistent(ly ugly) ... pending a more thorough fixing of the Java Broker
>> configuration...
>>
>>
>
> My vote would be to use names as data, not as metadata, in the short term
> fix ;->
>

Well - given that the Queue configuration works...we have lots of people
using it... etc... I'm less inclined to change that than to change the
configuration which is broken and no-one uses :-)

I agree that it's a particularly unlovely way of using XML...  however I
would rather fix config more generally and do it once, rather than breaking
it for people twice

-- Rob

Re: [Fwd: Re: can't config a fanout exchange]

Posted by Jonathan Robie <jo...@redhat.com>.
Robert Godfrey wrote:
> The fundamental problem (IMHO) is that queue and exchange configuration is
> ill-suited to being in a hand editable config file.  My understanding is
> that the C++ broker stores this info in a database and you use tools to
> manage it.
>   

I think there are advantages to a human-readable representation that is 
easily exchanged and easily changed. I think that file could be designed 
better, either in XML or in some other format (e.g. Google Protocol 
Buffers).

> Anyway - for the moment I suggest we just make queue and exchange
> consistent(ly ugly) ... pending a more thorough fixing of the Java Broker
> configuration...
>   

My vote would be to use names as data, not as metadata, in the short 
term fix ;->

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: [Fwd: Re: can't config a fanout exchange]

Posted by Robert Godfrey <ro...@gmail.com>.
The root of this problem in the Java Broker stems from the fact that we try
to use Commons Configuration in a way that would work both with a properties
file style, and an XML style...

Originally this was all done positionally, but didn't work too well when
some objects were optional.  Right now the code seems to be looking for a
subset of configuration based on a positional syntax which is valid for
getting individual elements but may not be valid for subsets...

The fundamental problem (IMHO) is that queue and exchange configuration is
ill-suited to being in a hand editable config file.  My understanding is
that the C++ broker stores this info in a database and you use tools to
manage it.

Anyway - for the moment I suggest we just make queue and exchange
consistent(ly ugly) ... pending a more thorough fixing of the Java Broker
configuration...

-- Rob

2009/10/1 Martin Ritchie <ri...@apache.org>

> 2009/9/30 Jonathan Robie <jo...@redhat.com>:
> > Martin Ritchie wrote:
> >>
> >> Indeed and it makes it very difficult it validate, AIUI XML parsers
> >> can't validate XML with dynamicly created elements.
> >>
> >> How does the CPP broker do it.. starting to make steps to move towards
> >> a single configuration file format would be great.
> >>
> >
> > The CPP broker uses .conf files with name=value, not XML.
> >
> > Is anyone pushing to move that to XML? I think most people are pretty
> happy
> > with the current format.
>
> I wasn't suggesting that XML should the file format. I seem to
> remember opening this can a while ago but we never made a decision on
> what to do. I think there would need to be a compeling reason to
> change the format used by both brokers. Having configuration that is
> useable by both would be a good goal for the project.
>
> Martin
>
> > Jonathan
> >
> > ---------------------------------------------------------------------
> > Apache Qpid - AMQP Messaging Implementation
> > Project:      http://qpid.apache.org
> > Use/Interact: mailto:dev-subscribe@qpid.apache.org
> >
> >
>
>
>
> --
> Martin Ritchie
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
>
>

Re: [Fwd: Re: can't config a fanout exchange]

Posted by Martin Ritchie <ri...@apache.org>.
2009/9/30 Jonathan Robie <jo...@redhat.com>:
> Martin Ritchie wrote:
>>
>> Indeed and it makes it very difficult it validate, AIUI XML parsers
>> can't validate XML with dynamicly created elements.
>>
>> How does the CPP broker do it.. starting to make steps to move towards
>> a single configuration file format would be great.
>>
>
> The CPP broker uses .conf files with name=value, not XML.
>
> Is anyone pushing to move that to XML? I think most people are pretty happy
> with the current format.

I wasn't suggesting that XML should the file format. I seem to
remember opening this can a while ago but we never made a decision on
what to do. I think there would need to be a compeling reason to
change the format used by both brokers. Having configuration that is
useable by both would be a good goal for the project.

Martin

> Jonathan
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
>
>



-- 
Martin Ritchie

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: [Fwd: Re: can't config a fanout exchange]

Posted by Jonathan Robie <jo...@redhat.com>.
Martin Ritchie wrote:
> Indeed and it makes it very difficult it validate, AIUI XML parsers
> can't validate XML with dynamicly created elements.
>
> How does the CPP broker do it.. starting to make steps to move towards
> a single configuration file format would be great.
>   

The CPP broker uses .conf files with name=value, not XML.

Is anyone pushing to move that to XML? I think most people are pretty 
happy with the current format.

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: [Fwd: Re: can't config a fanout exchange]

Posted by Martin Ritchie <ri...@apache.org>.
2009/9/30 Jonathan Robie <jo...@redhat.com>:
> Hmmm, the markup in the "wrong" configuration file is a lot more
> straightforward.
>
> I find it confusing to use the name of the exchange is used as both data and
> metadata (element content and the name of an element).

Indeed and it makes it very difficult it validate, AIUI XML parsers
can't validate XML with dynamicly created elements.

How does the CPP broker do it.. starting to make steps to move towards
a single configuration file format would be great.

Martin

> Jonathan
>
> And a little more digging....
>
> Looking at how the code interprets the configuration file, versus how the
> example is used in virtualhosts.xml ... it appears to me as if the example
> in our release is wrong
>
> I *think* that instead of looking like
>
> <exchange>
>    <name>test</name>
>    <type>fanout</type>
>    <durable>true</durable>
> </exchange>
>
> instead it should be specified as
>
> <exchange>
>    <name>test</name>
>    <test>   <!-- use tag with the same name as the exchange you are
> defining -->
>        <type>fanout</type>
>        <durable>true</durable>
>    </test>
> </exchange>
>
> There is some code that says that if it doesn't find a configuration,
> default to direct as the type....
>
> I shall test this tomorrow when I'm back using a computer that's actually
> capable of running the broker
>
> Apologies,
> Rob
>
> 2009/9/30 Robert Godfrey <ro...@gmail.com>
>
>> Hi Mark,
>>
>> 2009/9/30 mARK bLOORE <mb...@gmail.com>
>>
>>> Thanks for the reply, Rob, but actually I set the exchange to fanout
>>> in the config file, and declared it to be fanout in my code, but the
>>> broker seems to think it was configured as direct.
>>>
>>> If I don't configure it the code runs fine, but I would rather have it
>>> already exist, so that I can publish to it without having to ensure
>>> that a queue is bound to it first.
>>>
>>>
>>>
>> My apologies, I read the error message in haste.... and must have mentally
>> swapped the order of "fanout" and "direct"
>>
>> The error code from the Java Broker says
>>
>> 'Attempt to redeclare exchange: test-exchange of type direct to
>> fanout. [error code 530: not allowed]'
>>
>> This is generated by the following code inside the Java Broker:
>>
>> else if (!exchange.getType().equals(body.getType()))
>>             {
>>
>>                 throw new AMQConnectionException(AMQConstant.NOT_ALLOWED,
>> "Attempt to redeclare exchange: " + body.getExchange() + " of type " +
>> exchange.getType() + " to " + body.getType() +".",body.getClazz(),
>> body.getMethod(),body.getMajor(),body.getMinor(),null);
>>             }
>>
>> So it appears that the config is creating a direct exchange and not a
>> fanout exchange as you would expect...
>>
>> I'm presuming that your config:
>>
>>            <exchanges>
>>                <exchange>
>>                    <type>fanout</type>
>>                    <name>test-exchange</name>
>>                    <durable>true</durable>
>>                </exchange>
>>            <.exchanges>
>>
>> is not a completely accurate cut and paste (i.e. the last line is actually
>> </exchanges> in the config file?)
>>
>> However looking at the current codebase I can see no reason why an
>> exchange
>> declared in the config would be created as direct... Can you confirm which
>> release of the broker you are using?
>>
>> Thanks,
>> Rob
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
>



-- 
Martin Ritchie

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org