« Return to Thread: Automated queue creation within a swiftlet

Re: Automated queue creation within a swiftlet

by Chad12 () :: Rate this Message:

Reply to Author | View in Thread

Yes, using before-cli etc is only useful for static configuration. We need our system to be centrally administered, so static XML configuration across various SwiftMQ boxes isn't really suitable; hence my attempts to load and reconfigure our extension swiftlet dynamically. I'm still not really clear on the functional differences between regular and system queues; i.e what you can and can't use them for, but I'm going to assume now that I need regular queues, so they can potentially interact with swiftlets other than our main extension swiftlet. You mention
IIT Software wrote:
if you determine the queue name programmatically, you will do it with API-calls directly in your Swiftlet's startup method
- as I said above, this is what I am now trying to do, however I am getting some sporadic errors like:
2009-07-05 21:18:44,130 [main] ERROR - Error creating new queue
com.swiftmq.tools.requestreply.TimeoutException: Request timeout occured (60000) ms
	at com.swiftmq.admin.mgmt.EndpointFactory$EndpointCreator.request(Unknown Source)
	at com.swiftmq.admin.mgmt.EndpointFactory$EndpointCreator.create(Unknown Source)
	at com.swiftmq.admin.mgmt.EndpointFactory.createEndpoint(Unknown Source)
	at com.swiftmq.admin.cli.CLI.createEndpoint(Unknown Source)
	at com.swiftmq.admin.cli.CLI.init(Unknown Source)
	at com.swiftmq.admin.cli.CLI.(Unknown Source)
	at MySwiftlet.verifyQueueExists(MySwiftlet.java:690)
	...
	at MySwiftlet.startup(MySwiftlet.java:97)
	at com.swiftmq.swiftlet.SwiftletManager.startUpSwiftlet(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletManager.loadExtensionSwiftlet(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletDeployer.start(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletDeployer$4.swiftletStarted(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletManager.fireSwiftletManagerEvent(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletManager.startUpSwiftlet(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletManager.startKernelSwiftlet(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletManager.startKernelSwiftlets(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletManager.initSwiftlets(Unknown Source)
	at com.swiftmq.swiftlet.SwiftletManager.startRouter(Unknown Source)
	at com.swiftmq.Router.main(Unknown Source)
I cannot work out how to reliably repeat these errors, but it does make me a little worried. Are there potentially any timing issues with creating CLI connections during the startup of a Swiftlet? In the timeout above, I notice that my cli.bat connections to the same router only say "Router 'myrouter' is available for administration" after the above call has timed out. How do you suggest I debug this further? Secondly, what's the best way to internally (Swiftlet API) obtain the correct provider URL to obtain a queue connection to use with the CLI? I'm currently using the below, but given I'm inside a Swiftlet, surely there's a better way to obtain the listener port at least? Or should I just use an intravm connection factory instead? I'm not sure from the documentation whether it's intended for this purpose.
Hashtable env = new Hashtable();
			env.put(Context.INITIAL_CONTEXT_FACTORY,"com.swiftmq.jndi.InitialContextFactoryImpl");
env.put(Context.PROVIDER_URL,"smqp://localhost:4207/timeout=10000");
InitialContext ctx = new InitialContext(env);
QueueConnectionFactory connectionFactory = (QueueConnectionFactory)ctx.lookup("QueueConnectionFactory");
connection = connectionFactory.createQueueConnection();
ctx.close();
CLI cli = new CLI(connection);

 « Return to Thread: Automated queue creation within a swiftlet