PSRabbitMq icon indicating copy to clipboard operation
PSRabbitMq copied to clipboard

Send-RabbitMqMessage send allways the same body when pipeline is used

Open code-numericoverflow opened this issue 4 years ago • 1 comments

When using the pipeline the body is not re-calculated for each inputObject, $Body is tested to be re-created and has a value. I changed to:

     process
    {
        **$Body = $null**
        switch ($SerializeAs) {

code-numericoverflow avatar Jan 17 '20 10:01 code-numericoverflow

I believe I have the same issue:

` #Send a message - Works fine Send-RabbitMqMessage -ComputerName $messageServer -Exchange $exchange -Key $routing_key -InputObject $message -ContentType 'application/json' @Params -ErrorAction Stop

#In same terminal set a variable $Body to something $Body = "something"

#Send the same message as before again. Send-RabbitMqMessage -ComputerName $messageServer -Exchange $exchange -Key $routing_key -InputObject $message -ContentType 'application/json' @Params -ErrorAction Stop

Send-RabbitMqMessage : Cannot convert argument "body", with value: "thing", for "BasicPublish" to type "System.Byte[]": "Cannot convert value "thing" to type "System.Byte[]". Error: "Cannot convert value "thing" to type "System.Byte". Error: "Input string was not in a correct format.""" At line:1 char:1

  • Send-RabbitMqMessage -ComputerName $messageServer -Exchange $exchange ...
  •   + CategoryInfo          : NotSpecified: (:) [Send-RabbitMqMessage], MethodException
      + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument,Send-RabbitMqMessage
    

`

Dragonsong3k avatar Feb 21 '21 21:02 Dragonsong3k