Consume messages via powershell

295 views
Skip to first unread message

Patrick von der Hagen

unread,
Jan 28, 2016, 1:03:37 PM1/28/16
to rabbitmq-users
Hi all,

need to use powershell to read messages from RabbitMQ. Usually I prefer Python or Java, but since I have to invoke some powershell-commandlets, I'm trying powershell instead.

Problem: when doing

[System.Reflection.Assembly]::LoadFile("C:\temp\RabbitMQ.Client.dll")

$factory = New-Object RabbitMQ.Client.ConnectionFactory
#Verbindungsdaten für den RabbitMQ Server
$factory.HostName = $hostname

I run into an exception:

The field or property: "uri" for type: "RabbitMQ.Client.ConnectionFactory" differs only in letter casing from the field
or property: "Uri". The type must be Common Language Specification (CLS) compliant.


I had a look at PoshRabbit, but it has some issues and is probably unusable in my setup.

Any help would be greatly appreciated.

Yours,
Patrick.

Michael Klishin

unread,
Jan 28, 2016, 3:42:51 PM1/28/16
to rabbitm...@googlegroups.com, Patrick von der Hagen
On 28 January 2016 at 21:03:40, Patrick von der Hagen (patrick...@gmail.com) wrote:
> The field or property: "uri" for type: "RabbitMQ.Client.ConnectionFactory"
> differs only in letter casing from the field
> or property: "Uri". The type must be Common Language Specification
> (CLS) compliant.

I’m not knowledgeable enough of PowerShell but I’m curious how do things work in other
scenarios?

This is the first time I see this conflict reported.

I guess you can write a tiny wrapper app that uses the .NET client .
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Patrick von der Hagen

unread,
Feb 1, 2016, 12:23:35 PM2/1/16
to Michael Klishin, rabbitm...@googlegroups.com
Don't know where to get a Visual Studio (or a windows desktop) on short notice, so a wrapper is not an option.
But a colleague had to create a powershell-client one or two years ago. The dll he has been using identifies as "RabbitMQ Client Library fro .Net", "Copyright @2007-2013 GoPivotalInc." and works fine.

Patrick von der Hagen

unread,
Feb 1, 2016, 12:33:02 PM2/1/16
to Michael Klishin, rabbitm...@googlegroups.com
I forgot: Windows 2012R2, Powershell 4.0. The DLL I'm currently using identifies as 2.0.50727 when I perform LoadFile.

Michael Klishin

unread,
Feb 1, 2016, 4:32:28 PM2/1/16
to rabbitm...@googlegroups.com, Patrick von der Hagen
On 1 February 2016 at 20:32:55, Patrick von der Hagen (patrick...@gmail.com) wrote:
> The dll he has been using identifies as "RabbitMQ Client Library
> fro .Net", "Copyright @2007-2013 GoPivotal, Inc." and works
> fine.

Newer versions of the client require newer .NET versions and have API changes.

You can download older versions in the archive:
http://www.rabbitmq.com/releases/rabbitmq-dotnet-client/ 

Patrick von der Hagen

unread,
Feb 2, 2016, 4:06:46 AM2/2/16
to Michael Klishin, rabbitm...@googlegroups.com
The OS is Windows Server 2012r2. Default .net-Environment is 4.5 and default powershell is 4.0. AFAIK version 4.0 of powershell does not imply it is not using .net 4.5, but I failed to find any specific information.




Reply all
Reply to author
Forward
0 new messages