|
Page Edited :
qpid :
Qpid Java FAQ
Qpid Java FAQ has been edited by Marnie McCormack (Aug 01, 2008). Content:What is Qpid ?The java implementation of Qpid is a pure Java message broker that implements the AMQP protocol. Essentially, Qpid is a robust, performant middleware component that can handle your messaging traffic. It currently supports the following features:
Can you help me get started with Qpid?Have a look at our Getting Started Guide How do I install the Qpid broker ?Please follow the instructions provided on our Getting Started Guide. How do I run the Qpid broker ?The broker comes with a script for unix/linux/cygwin called qpid-server, which can be found in the bin directory of the installed package. This command can be executed without any paramters and will then use the default configuration file provided on install. For the Windows OS, please use qpid-server.bat. There's no need to set your classpath for QPID as the scripts take care of that by adding jar's with classpath defining manifest files to your classpath. For more information on running the broker please see our Getting Started page. How can I create a connection using a URL ?The format for connection URL in QPID is as follows: amqp://[user:[EMAIL PROTECTED]/virtualhost?brokerlist='[transport://]host[:port][?option='value'[&option='value']];'
[&failover='method[?option='value'[&option='value']]']
[&option='value']"
Don't be alarmed - it's really not that complex !
How do I represent a JMS Destination string with QPID ?QueuesA queue can be created in QPID using the following URL format. direct://amq.direct//<Queue Name> For example: direct://amq.direct//simpleQueue Queue names may consist of any mixture of digits, letters, and underscores. TopicsA topic can be created in QPID using the following URL format. topic://amq.topic/<Topic Subscription>/ The topic subscription may only contain the letters A-Z and a-z and digits 0-9. cloak.memory.duration = 0 The topic subscription is formed from a series of words that may only contain the letters A-Z and a-z and digits 0-9. For example: stocks.nyse.ibm Wildcards can be used on subscription with the following meaning.
For example: Publishing stocks.nyse.ibm will be received by both clients but stocks.ibm and stocks.world.us.ibm will only be received by client 2. The topic currently does not support wild cards. How do I connect to the broker using JNDI ?see How to use JNDI I'm using Spring and Weblogic - can you help me with the configuration for moving over to Qpid ?Here is a donated Spring configuration file appContext.zip How do I configure the logging level for Qpid ?The system property amqj.logging.level For the broker, you can use the environment variable AMQJ_LOGGING_LEVEL which is picked up by the qpid-run script (called by qpid-server to start the broker) at runtime. For client code that you've written, simply pass in a system property to your command line to set it to the level you'd like i.e. -Damqj.logging.level=INFO The log level for the broker defaults to INFO if the env variable is not set, but you may find that your log4j properties affect this. Setting the property noted above should address this. How can I configure the broker ?The broker configuration is contained in the <installed-dir>/etc/config.xml file. You can copy and edit this file and then specify your own configuration file as a parameter to the startup script using the -c flag i.e. qpid-server -c <your_config_file's_path> For more detailed information on configuration, please see Qpid Design - Configuration How can I change the port the broker uses at runtime ?The broker defaults to use port 5672 at startup. To change this, use the -p flag at startup i.e. qpid-server -p <port_number_to_use> Use this to get round any issues on your host server with port 5672 being in use/unavailable. For more detailed information on configuration, please see Qpid Design - Configuration What command line options can I pass into the qpid-server script ?The following options are available:
For more detailed information on configuration, please see Qpid Design - Configuration How do I authenticate with the broker ? What user id & password should I use ?You should login as user guest with password guest How do I create queues that will always be instantiated at broker startup ?You can configure queues which will be created at broker startup by tailoring a copy of the virtualhosts.xml file provided in the installed qpid-version/etc directory. So, if you're using a queue called 'devqueue' you can ensure that it is created at startup by using an entry something like this: <virtualhosts>
<default>test</default>
<virtualhost>
<name>test</name>
<test>
<queue>
<name>devqueue</name>
<devqueue>
<exchange>amq.direct</exchange>
<maximumQueueDepth>4235264</maximumQueueDepth> <!-- 4Mb -->
<maximumMessageSize>2117632</maximumMessageSize> <!-- 2Mb -->
<maximumMessageAge>600000</maximumMessageAge> <!-- 10 mins -->
</devqueue>
</queue>
</test>
</virtualhost>
</virtualhosts>
Note that the name (in thie example above the name is 'test') element should match the virtualhost that you're using to create connections to the broker. This is effectively a namespace used to prevent queue name clashes etc. You can also see that we've set the 'test' virtual host to be the default for any connections which do not specify a virtual host (in the <default> tag). You can amend the config.xml to point at a different virtualhosts.xml file by editing the <virtualhosts/> element. So, for example, you could tell the broker to use a file in your home directory by creating a new config.xml file with the following entry: <virtualhosts>/home/myhomedir/virtualhosts.xml</virtualhosts> You can then pass this amended config.xml into the broker at startup using the -c flag i.e. Where do undeliverable messages end up ?At present, messages with an invalid routing key will be returned to the sender. If you register an exception listener for your publisher (easiest to do by making your publisher implement the ExceptionListener interface and coding the onException method) you'll see that you end up in onException in this case. You can expect to be catching a subclass of org.apache.qpid.AMQUndeliveredException. Can I configure the name of the Qpid broker log file at runtime ?If you simply start the Qpid broker using the default configuration, then the log file is written to $QPID_WORK/log/qpid.log This is not ideal if you want to run several instances from one install, or acrhive logs to a shared drive from several hosts. To make life easier, there are two optional ways to configure the naming convention used for the broker log. Setting a prefix or suffixUsers should set the following environment variables before running qpid-server: QPID_LOG_PREFIX - will prefix the log file name with the specified value e.g. if you set this value to be the name of your host (for example) it could look something like host123qpid.log QPID_LOG_SUFFIX - will suffix the file name with the specified value e.g. if you set this value to be the name of your application (for example) if could look something like qpidMyApp.log Including the PIDSetting either of these variables to the special value PID will introduce the process id of the java process into the file name as a prefix or suffix as specified** My client application appears to have hung?The client code currently has various timeouts scattered throughout the code. These can cause your client to appear like it has hung when it is actually waiting for the timeout ot compelete. One example is when the broker becomes non-responsive, the client code has a hard coded 2 minute timeout that it will wait when closing a connection. These timeouts need to be consolidated and exposed. see QPID-429 How do I contact the Qpid team ?For now, subscribe to our developer list (email [EMAIL PROTECTED]). A users list is currently being set up! How can I change a user's password while the broker is up ?You can do this via the management console if you're using the base64password file (rather than plain text). To do this simply log in to the management console as an admin user (you need to have created an admin account in the jmxremote.access file first) and then select the 'Manage Users' pane. There is a 'Change Password' tab which you can then use. Alternatively, update the base64password file and use the management console to reload the file, in the 'Manage Users' pane. In both cases, this will take effect when the user next logs in i.e. will not cause them to be disconnected if they are already connected. For more information on the Management Console please see our Qpid Management Console User Guide. If you're using plain text passwords, then simply update your file and the content is read on every connection. |
Unsubscribe or edit your notifications preferences
