I work with RabbitMQ on a foreign project and have problems with deleting and missing data.
The data is all there, like a string when I publish, and also where it is right, in the RabbitMQ queue. When I pull out the data, the data data there is similar to the user ID, but the rest of it is missing. I looked through all the code, and I'm pretty sure something is happening with RabbitMQ, and this happens when I delete. Any help would be greatly appreciated. Thank you Here is the code before posting.
private bool sendJobToMQ(EncodeJobModel job, string p_correlation_id, string p_request_routing_key) { JavaScriptSerializer ser = new JavaScriptSerializer(); StringBuilder sb_job = new StringBuilder(); ser.Serialize(job, sb_job); string rpc_reply_queue; ConnectionFactory factory = new ConnectionFactory(); factory.HostName = HOST_NAME; factory.VirtualHost = VHOST_NAME; factory.UserName = USERNAME; factory.Password = PASSWORD; IConnection rabconn = factory.CreateConnection(); IModel sender_channel = rabconn.CreateModel(); try { sender_channel.ExchangeDeclare(EXCHANGE_NAME, ExchangeType.Direct, true, false, null); } catch (Exception err) { logger.Error("Error Declaring Exchange " + EXCHANGE_NAME + ": " + err.ToString()); return false; } try { sender_channel.QueueDeclare(REQUEST_QUEUE, true, false, false, null); } catch (Exception err) { logger.Error("Error QueueDeclare (" + REQUEST_QUEUE + " true, false, false, null): " + err.ToString()); return false; } try { sender_channel.QueueBind(REQUEST_QUEUE, EXCHANGE_NAME, REQUEST_ROUTING_KEY, null); } catch (Exception err) { logger.Error("Error QueueBind (" + REQUEST_QUEUE + " -> " + EXCHANGE_NAME + " " + REQUEST_ROUTING_KEY + ", null): " + err.ToString()); return false; }
And the code for dequeue.
QueueingBasicConsumer consumer = new QueueingBasicConsumer(p_channel); string consumerTag = p_channel.BasicConsume(p_queue, false, consumer); if (_is_console && Environment.UserInteractive) Console.WriteLine("Listening..."); while (m_Listen) { try { //get the properties of the message, including the ReplyTo queue, to which we can append '_routingkey' (designated by me), to reply with messages BasicDeliverEventArgs e; Object message; if (!consumer.Queue.Dequeue(4000, out message)) { // we do not wait to indefinitely block on waiting for the queue // if nothing in queue continue loop iteration and wait again continue; } // cast as necessary back to BasicDeliverEventArgs e = (BasicDeliverEventArgs)message; IBasicProperties props = e.BasicProperties; //get the Correlation ID sent by the client to track the job string client_correlation_id = props.CorrelationId; // I left out the reply_to field in the wizard, it can be set back in ApiEncodeServiceDefault - Steve "Smurfing Smurf" Han //string reply_to = props.ReplyTo; //get the body of the request byte[] body = e.Body; string body_result = Encoding.UTF8.GetString(body); bool redelivered = e.Redelivered;
There is no data in the e.Body row.