Sarmaad / WebJobs.Extensions.RabbitMQ

Apache License 2.0
7 stars 8 forks source link

System.MissingMethodException when doing JobHostConfiguration.UseRabbitMq(endpoint) #1

Open jselling opened 7 years ago

jselling commented 7 years ago

"Method not found: 'Void RabbitMQ.Client.ConnectionFactory.set_Uri(System.String)'."

Seems like this could be related to an update in RabbitMQ Client https://github.com/EasyNetQ/EasyNetQ/issues/719

Sarmaad commented 7 years ago

thank you. i will update the code to the latest RabbitMq client

tasoss commented 6 years ago

Hello. Any news on this?

ampac28 commented 5 years ago

@Sarmaad I am using RabbitMQ. Client library v 5.0 and your code is using v 4.1 which is not compatible. Similar incompatibility issue in Windows storage library as well I am facing "Could not load type 'Microsoft.WindowsAzure.Storage.Table.DataServices.TableServiceContext' from assembly 'Microsoft.WindowsAzure.Storage, Version=9.3.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."

Any update can you share like when you are going to update the nuget package.

As of now I have written my own customer code for Rabbit MQ queue subscription and in webjob to make it continuous I am subscribing messages in a while(true) loop so that webjob should be keep in running state . Check out below code and share your thoughts on .

[NoAutomaticTrigger()] public void ProcessMethod(TextWriter log) { while (true) { try { Console.WriteLine("ProcessMethod() method execution initiated."); using (IConnection connection = _consumerdependency.OpenConnection()) using (var channel = connection.CreateModel()) { Console.WriteLine($"---------------------------{DateTime.Now} : Connection established. Channel opened.---------------------------"); while (connection.IsOpen) { var basicConsumer = new EventingBasicConsumer(channel); basicConsumer.Received += (model, ea) => { var queueMessage = Encoding.UTF8.GetString(ea.Body); //// ... process the message _consumerdependency.ProcessMessage(queueMessage).Wait(); channel.BasicAck(ea.DeliveryTag, false); Console.WriteLine(" [Message Received]: {0}", queueMessage);

                        };

                        String consumerTag = channel.BasicConsume(ConfigurationManager.AppSettings["queue"], false, basicConsumer);
                    }

                    Console.WriteLine("Channel not opened!! ");
                    Console.WriteLine("Reconnect & Open RabbitMQ channel!! ");
                }

                log.WriteLine("ProcessMethod() method execution over.");
                Console.WriteLine("ProcessMethod() method execution over.");
            }
            catch (Exception ex)
            {
                log.WriteLine($"Error occurred in processing messages. Error : {ex.Message}");
                Console.WriteLine($"Error occurred in processing messages.Error : {ex.Message}");
            }
        }

    }