In order to keep the program efficient, it is recommended to use PROTOBUF.
Google Protocol Buffer (protobuf) is a mixed-language data standard within Google, with more than 48,162 message format definitions and more than 12,183. proto files already in use. They are used for RPC systems and continuous data storage systems.
Protocol buffers is a lightweight and efficient structured data storage format that can be used for structured data serialization, or serializing.
NET is also very simple to obtain in NuGet, using attribute tags, a bit like a contract in WCF.
[protocontract] publicclass testquene { [Protomember (1 )] publicint Id { get; Set ; }
The simple queue team in the team and out of the team test, the effect is good.
for(inti =0; I < -; i++) {MemoryStream XMLW=NewMemoryStream (); Testquene temptest=NewTestquene () {Id = i, data =Newlist<string> (New string[] {"1","2","3" }) }; Serializer.serialize<TestQuene>(XMLW, temptest); Message=convert.tobase64string (XMLW. ToArray ()); Console.WriteLine ("enqueueitemonlist="+message); Redis. Enqueueitemonlist ("Messagequene", message); }
Threadpool.unsafequeueuserworkitem (o = { while(true) { Try{MemoryStream ms=NewMemoryStream (Convert.frombase64string (Redis. Blockingpopitemfromlist ("Messagequene", Timespan.fromhours (2)))); Console.WriteLine ("while="+ serializer.deserialize<testquene>(ms)); } Catch(Exception ex) {Debug.WriteLine (ex). ToString ()); } } }, NULL);
Redis Easy Message Queuing