}
public Message sendNextMessage(final CreateProducerCommand command)
{
Message sentMessage = null;
MessageProvider messageProvider = _testMessageProviders.get(command.getMessageProviderName());
if (messageProvider == null)
{
messageProvider = _defaultMessageProvider;
}
final Session session = _testSessions.get(command.getSessionName());
final MessageProducer producer = _testProducers.get(command.getParticipantName());
try
{
sentMessage = messageProvider.nextMessage(session, command);
int deliveryMode = producer.getDeliveryMode();
int priority = producer.getPriority();
long ttl = producer.getTimeToLive();
if (messageProvider.isPropertySet(MessageProvider.PRIORITY))
{
priority = sentMessage.getJMSPriority();
}
if (messageProvider.isPropertySet(MessageProvider.DELIVERY_MODE))
{
deliveryMode = sentMessage.getJMSDeliveryMode();
}
if (messageProvider.isPropertySet(MessageProvider.TTL))
{
ttl = sentMessage.getLongProperty(MessageProvider.TTL);
}
producer.send(sentMessage, deliveryMode, priority, ttl);
}