public void createProviderDestination(String destinationName,
int destinationType,
java.util.Map properties)
throws JMSException {
ObjectMessage requestMesg = null;
Message replyMesg = null;
// Create DestinationInfo.
DestinationInfo di = new DestinationInfo();
di.setName(destinationName);
// REVISIT:
// We only check for queueDeliveryPolicy in the properties
// hard-coded string; left here because we are not sure
// if we are going to expose this attribute yet
String qPolicy = null;
/*
* Early initialization to be used in error messages
*/
int typeMask = this.getDestTypeMask(destinationType, null);
if (properties != null) {
if (properties.containsKey("queueDeliveryPolicy")) {
qPolicy = (String)properties.get("queueDeliveryPolicy");
typeMask = this.getDestTypeMask(destinationType, qPolicy);
}
if (properties.containsKey(
BrokerCmdOptions.PROP_NAME_MAX_ACTIVE_CONSUMER_COUNT)) {
Object tmp = null;
String val = null;
tmp = properties.get(
BrokerCmdOptions.PROP_NAME_MAX_ACTIVE_CONSUMER_COUNT);
if (tmp != null) {
if (!(tmp instanceof String)) {
JMSException jmse;
jmse = new JMSException(
ar.getString(ar.E_SPI_DEST_CREATION_FAILED,
DestType.toString(typeMask),
destinationName)
+ "\n"
+ ar.getString(ar.E_SPI_ATTR_TYPE_NOT_STRING,
BrokerCmdOptions.PROP_NAME_MAX_ACTIVE_CONSUMER_COUNT)
);
throw jmse;
}
val = (String)tmp;
try {
di.setMaxActiveConsumers(Integer.parseInt(val));
} catch (Exception e) {
JMSException jmse;
jmse = new JMSException(
ar.getString(ar.E_SPI_DEST_CREATION_FAILED,
DestType.toString(typeMask),
destinationName)
+ "\n"
+ ar.getString(ar.E_INVALID_INTEGER_VALUE,
val,
BrokerCmdOptions.PROP_NAME_MAX_ACTIVE_CONSUMER_COUNT));
throw (jmse);
}
}
}
}
di.setType(typeMask);
requestMesg = session.createObjectMessage();
requestMesg.setJMSReplyTo(replyQueue);
requestMesg.setIntProperty
(MessageType.JMQ_MESSAGE_TYPE, MessageType.CREATE_DESTINATION);
requestMesg.setObject(di);
sender.send(requestMesg);
replyMesg = receiver.receive(timeout);
replyMesg.acknowledge();