[rabbitmq-discuss] Messages disappearing

Nick Pateman nick.pateman at certivox.com
Wed Nov 16 17:02:40 GMT 2011


Here's the method I'm using to send the messages, the connection has already been established by this point...

void send_batch(amqp_connection_state_t conn,
               char const *queue_name,
               int rate_limit,
               int message_count)
{
  uint64_t start_time = now_microseconds();
  int i;
  int sent = 0;
  int previous_sent = 0;
  uint64_t previous_report_time = start_time;
  uint64_t next_summary_time = start_time + SUMMARY_EVERY_US;

  char message[256];
  amqp_bytes_t message_bytes;

  for (i = 0; i < sizeof(message); i++) {
    message[i] = i & 0xff;
  }

  message_bytes.len = sizeof(message);
  message_bytes.bytes = message;

  for (i = 0; i < message_count; i++) {
    uint64_t now = now_microseconds();

    amqp_basic_properties_t props;
    props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;
    props.content_type = amqp_cstring_bytes("text/plain");
    props.delivery_mode = 2; /* persistent delivery mode */
    die_on_error(amqp_basic_publish(conn,
            1,
            amqp_cstring_bytes("amq.direct"),
            amqp_cstring_bytes(queue_name),
            0,
            0,
            &props,
            amqp_cstring_bytes("Hello world!")),
            "Publishing");

    sent++;
    if (now > next_summary_time) {
      int countOverInterval = sent - previous_sent;
      double intervalRate = countOverInterval / ((now - previous_report_time) / 1000000.0);
      printf("%d ms: Sent %d - %d since last report (%d Hz)\n",
         (int)(now - start_time) / 1000, sent, countOverInterval, (int) intervalRate);

      previous_sent = sent;
      previous_report_time = now;
      next_summary_time += SUMMARY_EVERY_US;
    }

    while (((i * 1000000.0) / (now - start_time)) > rate_limit) {
      microsleep(2000);
      now = now_microseconds();
    }
  }

  {
    uint64_t stop_time = now_microseconds();
    int total_delta = stop_time - start_time;

    printf("PRODUCER - Message count: %d\n", message_count);
    printf("Total time, milliseconds: %d\n", total_delta / 1000);
    printf("Overall messages-per-second: %g\n", (message_count / (total_delta / 1000000.0)));
  }
}


From: Alvaro Videla [mailto:videlalvaro at gmail.com]
Sent: 16 November 2011 16:58
To: Nick Pateman
Cc: rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] Messages disappearing

If you post some sample code people might be able to help. Specifically the binding code and the publish code with routing keys.

Also does the original code works as expected?
On Wed, Nov 16, 2011 at 5:55 PM, Nick Pateman <nick.pateman at certivox.com<mailto:nick.pateman at certivox.com>> wrote:
Hey there,

I've got a small application writing messages to a message queue.  I basically modified an example taken from the C driver.

Anyway, I can see incoming and outgoing message rate increasing for the queue within the administration web page but I don't currently have any application picking up the messages, they seem to be getting instantly delivered somewhere else.

My rates jump from 0/0 to 10/10, 10 in a second and 10 out a second.

Any idea where my messages are going?  I want to see the counters increase before I get my daemon running.  Many thanks!

Nick.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111116/340d673d/attachment.htm>


More information about the rabbitmq-discuss mailing list