public void sendMessages(int messageCount, boolean sync) throws JBIException {
ComponentContext context = getContext();
for (int i = 0; i < messageCount; i++) {
InOnly exchange = context.getDeliveryChannel().createExchangeFactory().createInOnlyExchange();
NormalizedMessage msg = exchange.createMessage();
ServiceEndpoint destination = null;
if (resolver != null) {
destination = resolver.resolveEndpoint(getContext(), exchange, NullEndpointFilter.getInstance());
}
if (destination != null) {
// lets explicitly specify the destination - otherwise
// we'll let the container choose for us
exchange.setEndpoint(destination);
}
exchange.setInMessage(msg);
// lets set the XML as a byte[], String or DOM etc
msg.setContent(new StringSource(this.message));
if (sync) {
boolean result = context.getDeliveryChannel().sendSync(exchange, 1000);
if (!result) {