fix(TDI-38686):jms connection fails when use jndi (#1278)
This commit is contained in:
@@ -29,6 +29,7 @@ String timeout=ElementParameterParser.getValue(node, "__TIMEOUT__");
|
||||
String messageSelector=ElementParameterParser.getValue(node, "__MSG_SELECTOR__");
|
||||
String processingMode = ElementParameterParser.getValue(node, "__PROCESSING_MODE__");
|
||||
String msgType = ElementParameterParser.getValue(node, "__MSGTYPE__");
|
||||
boolean useJNDILookup="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__USE_JNDI_LOOKUP__"));
|
||||
|
||||
List<Map<String, String>> advProps = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__ADVANCED_PROPERTIES__");
|
||||
|
||||
@@ -77,9 +78,16 @@ if(advProps.size() > 0){
|
||||
%>
|
||||
|
||||
javax.jms.Session session_<%=cid%> = connection_<%=cid%>.createSession(false, javax.jms.Session.CLIENT_ACKNOWLEDGE);
|
||||
javax.jms.Destination dest_<%=cid%> = session_<%=cid%>.create<%=msgType%>(<%=from %>);
|
||||
|
||||
<%
|
||||
if(useJNDILookup){
|
||||
%>
|
||||
javax.jms.Destination dest_<%=cid%> = (javax.jms.Destination)context_<%=cid%>.lookup(<%=from %>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
javax.jms.Destination dest_<%=cid%> = session_<%=cid%>.create<%=msgType%>(<%=from %>);
|
||||
<%
|
||||
}
|
||||
if(enableSubscription){
|
||||
%>
|
||||
javax.jms.MessageConsumer consumer_<%=cid%> = session_<%=cid%>.createDurableSubscriber((javax.jms.Topic)dest_<%=cid%>,<%=subscriberName%>,<%=messageSelector%>,false);
|
||||
|
||||
@@ -65,11 +65,13 @@
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
<!-- Durable subscription end -->
|
||||
|
||||
<PARAMETER NAME="USE_JNDI_LOOKUP" FIELD="CHECK" NUM_ROW="28">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER
|
||||
NAME="MSGTYPE"
|
||||
FIELD="CLOSED_LIST"
|
||||
NUM_ROW="28">
|
||||
NUM_ROW="29">
|
||||
<ITEMS DEFAULT="TOPIC">
|
||||
<ITEM NAME="TOPIC" VALUE="Topic" />
|
||||
<ITEM NAME="QUEUE" VALUE="Queue" />
|
||||
|
||||
@@ -31,4 +31,6 @@ ADVANCED_PROPERTIES.ITEM.VALUE=Value
|
||||
|
||||
ENABLE_SUB.NAME=Enable Durable Subscription
|
||||
CLIENT_ID.NAME=ClientID
|
||||
SUBSCRIBER_NAME.NAME=Subscriber Name
|
||||
SUBSCRIBER_NAME.NAME=Subscriber Name
|
||||
|
||||
USE_JNDI_LOOKUP.NAME=Use JNDI Name Lookup Destination
|
||||
@@ -24,6 +24,7 @@ String user=ElementParameterParser.getValue(node, "__USER__");
|
||||
String to=ElementParameterParser.getValue(node, "__TO__");
|
||||
String deliverMode = ElementParameterParser.getValue(node, "__DELIVERY_MODE__");
|
||||
String msgType = ElementParameterParser.getValue(node, "__MSGTYPE__");
|
||||
boolean useJNDILookup="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__USE_JNDI_LOOKUP__"));
|
||||
|
||||
List<Map<String, String>> advProps = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__ADVANCED_PROPERTIES__");
|
||||
|
||||
@@ -59,7 +60,17 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
connection_<%=cid %>.start();
|
||||
|
||||
javax.jms.Session session_<%=cid %> = connection_<%=cid %>.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
|
||||
<%
|
||||
if(useJNDILookup){
|
||||
%>
|
||||
javax.jms.Destination dest_<%=cid%> = (javax.jms.Destination)context_<%=cid%>.lookup(<%=to %>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
javax.jms.Destination dest_<%=cid %> = session_<%=cid %>.create<%=msgType%>(<%=to %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
javax.jms.MessageProducer producer_<%=cid %> = session_<%=cid %>.createProducer(dest_<%=cid %>);
|
||||
|
||||
|
||||
@@ -48,10 +48,13 @@
|
||||
SHOW_IF="USER_IDENTITY == 'true'">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_JNDI_LOOKUP" FIELD="CHECK" NUM_ROW="26">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER
|
||||
NAME="MSGTYPE"
|
||||
FIELD="CLOSED_LIST"
|
||||
NUM_ROW="26">
|
||||
NUM_ROW="28">
|
||||
<ITEMS DEFAULT="TOPIC">
|
||||
<ITEM NAME="TOPIC" VALUE="Topic" />
|
||||
<ITEM NAME="QUEUE" VALUE="Queue" />
|
||||
|
||||
@@ -27,4 +27,6 @@ CONN_FACTORY_NAME.NAME=Connection Factory JNDI Name
|
||||
|
||||
ADVANCED_PROPERTIES.NAME=Properties
|
||||
ADVANCED_PROPERTIES.ITEM.PROPERTY=Property
|
||||
ADVANCED_PROPERTIES.ITEM.VALUE=Value
|
||||
ADVANCED_PROPERTIES.ITEM.VALUE=Value
|
||||
|
||||
USE_JNDI_LOOKUP.NAME=Use JNDI Name Lookup Destination
|
||||
Reference in New Issue
Block a user