Comments (11)
i think we have to serialize the object like this
_rabbitTemplate.ConvertAndSend(RECEIVE_AND_CONVERT_QUEUE, JsonConvert.SerializeObject(customMsg));
and then make Listner like this
[RabbitListener(RECEIVE_AND_CONVERT_QUEUE)] public void ListenForAMessage(string msg) { var x=JsonConvert.DeserializeObject<CustomQueue>(msg); _logger.LogInformation($"Received the message '{msg}' from the queue."); }
from samples.
@bradLucifer : Yes, the problem you are seeing is that by default we use BinaryFormatter to serialize objects. As a result on the receiving side the deserialization attempts to deserialize the payload and expects to find the type available so that it can create an instance of it. The type if finds is not the same one that is being sent because the assemblies they are in are different. So you have a couple options:
- Put the common type CustomQueue in a separate project and reference it the other two rabbitmq projects. That way the type will be common and in a shared assembly accessible by both.
- Switch to using Json for the serialization protocol.
Dave
from samples.
from samples.
@bradLucifer : Which do you prefer .. 1. Common project/.NET Serialization 2. JSON?
from samples.
from samples.
@bradLucifer : https://github.com/SteeltoeOSS/Samples/tree/main/Messaging/src/RabbitMQWeb2
I think this should help... See the Startup.cs file in each project for how to enable/disable the .NET serialization vs JSON.
from samples.
from samples.
In the startup.cs files for both projects, see the following comments.:
// Add Steeltoe Rabbit services, use default .NET serialization
//services.AddRabbitServices();
// Add Steeltoe Rabbit services, use JSON serialization
services.AddRabbitServices(true);
from samples.
from samples.
from samples.
from samples.
Related Issues (20)
- Freddy's BBQ Sample should be updated to .NET 6 HOT 2
- Music Store Sample should be updated to .NET 6
- Freddy's BBQ should have non-CF instructions
- versions typo
- Cancellation token issue HOT 2
- CloudFoundry credentials visible in pipeline test log
- using steeltoe and Consul HOT 2
- configure firewall to allow access to test databases
- UAA app is not recreated for CloudFoundry Single Sign On tests HOT 2
- Isolate integration testruns so they can run in parallel
- Update Python to 3.11 HOT 1
- add Slack notifications to Samples pipelines HOT 1
- Serilog.ILogger is not registered in IoC HOT 2
- Add code namespace to samples
- Add `stack: cflinuxfs4` to manifest files in Connector samples
- Consolidate and update Management Samples
- Update Security:RedisDataProtectionKeyStore sample to .NET 8
- Quality guidelines for samples HOT 1
- Add a sample console application using certificate auth
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from samples.