Permalink
Browse files

Fix for requiring oracle.jms.AQjmsFactory

Added a check to make sure that AQ was being used before we load the
oracle_a_q_connection factory. If this isn’t done
oracle.jms.AQjmsFactory is attempted to be pulled in.

Also updated examples for HornetQ 2.4.
  • Loading branch information...
1 parent 5d601de commit 727ea21aec651d7eec286ef6def00ee28227c098 @AlphaCluster AlphaCluster committed Feb 22, 2014
Showing with 17 additions and 9 deletions.
  1. +8 −8 examples/jms.yml
  2. +9 −1 lib/jms/connection.rb
View
@@ -80,12 +80,12 @@ hornetq:
java.naming.security.principal: guest
java.naming.security.credentials: guest
:require_jars:
- - ~/Applications/hornetq-2.2.2.Final/lib/hornetq-core-client.jar
- - ~/Applications/hornetq-2.2.2.Final/lib/hornetq-core.jar
- - ~/Applications/hornetq-2.2.2.Final/lib/hornetq-jms-client.jar
- - ~/Applications/hornetq-2.2.2.Final/lib/jboss-jms-api.jar
- - ~/Applications/hornetq-2.2.2.Final/lib/jnp-client.jar
- - ~/Applications/hornetq-2.2.2.Final/lib/netty.jar
+ - ~/Applications/hornetq-2.4.0.Final/lib/hornetq-commons.jar
+ - ~/Applications/hornetq-2.4.0.Final/lib/hornetq-core-client.jar
+ - ~/Applications/hornetq-2.4.0.Final/lib/hornetq-jms-client.jar
+ - ~/Applications/hornetq-2.4.0.Final/lib/jboss-jms-api.jar
+ - ~/Applications/hornetq-2.4.0.Final/lib/jnp-client.jar
+ - ~/Applications/hornetq-2.4.0.Final/lib/netty.jar
# IBM WebSphere MQ
wmq:
@@ -122,7 +122,7 @@ oracleaq_simple:
- ~/Applications/oraclestreams/aqapi.jar
- ~/Applications/oraclestreams/xdb.jar
- ~/Applications/oraclestreams/jta.jar
-
+
oracleaq_jndi:
:jndi_name: ConnectionFactory
:jndi_context:
@@ -135,4 +135,4 @@ oracleaq_jndi:
- ~/Applications/oraclestreams/jmscommon.jar
- ~/Applications/oraclestreams/aqapi.jar
- ~/Applications/oraclestreams/xdb.jar
- - ~/Applications/oraclestreams/jta.jar
+ - ~/Applications/oraclestreams/jta.jar
View
@@ -124,7 +124,6 @@ def fetch_dependencies(jar_list)
require 'jms/message_consumer'
require 'jms/message_producer'
require 'jms/queue_browser'
- require 'jms/oracle_a_q_connection_factory'
end
# Create a connection to the JMS provider
@@ -178,11 +177,20 @@ def initialize(params = {})
connection_factory = nil
factory = options.delete(:factory)
if factory
+ # If factory check if oracle is needed.
+ if (factory.include? 'AQjmsFactory')
+ require 'jms/oracle_a_q_connection_factory'
+ end
+
# If factory is a string, then it is the name of a class, not the class itself
factory = eval(factory) if factory.respond_to? :to_str
connection_factory = factory.new
elsif jndi_name = options[:jndi_name]
raise "Missing mandatory parameter :jndi_context missing in call to Connection::connect" unless jndi_context = options[:jndi_context]
+ if jndi_context['java.naming.factory.initial'].include? 'AQjmsInitialContextFactory'
+ require 'jms/oracle_a_q_connection_factory'
+ end
+
jndi = javax.naming.InitialContext.new(java.util.Hashtable.new(jndi_context))
begin
connection_factory = jndi.lookup jndi_name

0 comments on commit 727ea21

Please sign in to comment.