private Scenario getScenario(final Period p, final DummyDestination dd) throws Exception {
    final RunInfo ri = new RunInfo(p);

    final DefaultMessageGenerator mg = new DefaultMessageGenerator();
    mg.setThreads(100);
    mg.setSenderTaskQueueSize(1000);

    final ThroughputStatsReporter atr = new ThroughputStatsReporter();
    atr.registerDestination(dd, new Period(PeriodType.TIME, 500));

    final Message m = new Message();
    m.setPayload("hello");

    final MessageTemplate mt = new MessageTemplate(m, 1, null);

    final ScenarioBuilder sb = new ScenarioBuilder(ri, mg, DummySender.class.getName(), null);
    sb.addReporter(atr);
    sb.addMessage(mt);

    return sb.build();
  }
Esempio n. 2
0
 /*
  * (non-Javadoc)
  *
  * @see org.perfcake.message.sender.AbstractSender#doSend(org.perfcake.message.Message, java.util.Map)
  */
 @Override
 public Serializable doSend(
     final Message message, final Map<String, String> properties, final MeasurementUnit mu)
     throws Exception {
   if (log.isDebugEnabled()) {
     log.debug("Sending to " + target + "...");
   }
   if (delay > 0) {
     Thread.sleep(delay);
   }
   // nop
   return (message == null) ? message : message.getPayload();
 }