}
PublishKey pk = new PublishKey(glob, currOid, "text/xml", "1.0");
if (domain != null) pk.setDomain(domain);
pk.setClientTags(org.xmlBlaster.util.ReplaceVariable.replaceAll(clientTags, "%counter", currCounter));
PublishQos pq = new PublishQos(glob);
pq.setPriority(priority);
pq.setPersistent(persistent);
pq.setLifeTime(lifeTime);
pq.setForceUpdate(forceUpdate);
pq.setForceDestroy(forceDestroy);
pq.setSubscribable(subscribable);
if (clientPropertyMap != null) {
Iterator it = clientPropertyMap.keySet().iterator();
while (it.hasNext()) {
String key = (String)it.next();
pq.addClientProperty(key, clientPropertyMap.get(key).toString());
}
//Example for a typed property:
//pq.getData().addClientProperty("ALONG", (new Long(12)));
}
if (i == 0) {
TopicProperty topicProperty = new TopicProperty(glob);
topicProperty.setDestroyDelay(destroyDelay);
topicProperty.setCreateDomEntry(createDomEntry);
topicProperty.setReadonly(readonly);
if (historyMaxMsg >= 0L) {
HistoryQueueProperty prop = new HistoryQueueProperty(this.glob, null);
prop.setMaxEntries(historyMaxMsg);
topicProperty.setHistoryQueueProperty(prop);
}
if (consumableQueue)
topicProperty.setMsgDistributor("ConsumableQueue,1.0");
pq.setTopicProperty(topicProperty);
log.info("Added TopicProperty on first publish: " + topicProperty.toXml());
}
if (destination != null) {
log.fine("Using destination: '" + destination + "'");
Destination dest = new Destination(glob, new SessionName(glob, destination));
dest.forceQueuing(forceQueuing);
pq.addDestination(dest);
}
byte[] content;
if (contentSize >= 0) {
content = new byte[contentSize];
Random random = new Random();
for (int j=0; j<content.length; j++) {
content[j] = (byte)(random.nextInt(96)+32);
//content[j] = (byte)('X');
//content[j] = (byte)(j % 255);
}
}
else if (contentFile != null && contentFile.length() > 0) {
content = FileLocator.readFile(contentFile);
}
else {
content = org.xmlBlaster.util.ReplaceVariable.replaceAll(contentStr, "%counter", ""+(i+1)).getBytes();
}
if (log.isLoggable(Level.FINEST)) log.finest("Going to parse publish message: " + pk.toXml() + " : " + content + " : " + pq.toXml());
MsgUnit msgUnit = new MsgUnit(pk, content, pq);
if (log.isLoggable(Level.FINEST)) log.finest("Going to publish message: " + msgUnit.toXml());
if (oneway) {
MsgUnit msgUnitArr[] = { msgUnit };