ConversationFactory.Conversation[] senderConversation = new ConversationFactory.Conversation[senders.size()];
Destination[] senderControlTopic = new Destination[senders.size()];
for (int i = 0; i < senders.size(); i++)
{
TestClientDetails sender = senders.get(i);
senderControlTopic[i] = session.createTopic(sender.privateControlKey);
senderConversation[i] = conversationFactory.startConversation();
}
log.debug("Sender conversations created.");
// Create control conversations with each of the receivers.
ConversationFactory.Conversation[] receiverConversation = new ConversationFactory.Conversation[receivers.size()];
Destination[] receiverControlTopic = new Destination[receivers.size()];
for (int i = 0; i < receivers.size(); i++)
{
TestClientDetails receiver = receivers.get(i);
receiverControlTopic[i] = session.createTopic(receiver.privateControlKey);
receiverConversation[i] = conversationFactory.startConversation();
}
log.debug("Receiver conversations created.");
// Assign the sender role to each of the sending test clients.
for (int i = 0; i < senders.size(); i++)
{
TestClientDetails sender = senders.get(i);
Message assignSender = conversationFactory.getSession().createMessage();
TestUtils.setPropertiesOnMessage(assignSender, testProps);
assignSender.setStringProperty("CONTROL_TYPE", "ASSIGN_ROLE");
assignSender.setStringProperty("ROLE", "SENDER");
senderConversation[i].send(senderControlTopic[i], assignSender);
}
log.debug("Sender role assignments sent.");
// Assign the receivers role to each of the receiving test clients.
for (int i = 0; i < receivers.size(); i++)
{
TestClientDetails receiver = receivers.get(i);
Message assignReceiver = session.createMessage();
TestUtils.setPropertiesOnMessage(assignReceiver, testProps);
assignReceiver.setStringProperty("CONTROL_TYPE", "ASSIGN_ROLE");
assignReceiver.setStringProperty("ROLE", "RECEIVER");