BusHelper | 公交路线查询移动应用系统 - QPython webapp sample
kandi X-RAY | BusHelper Summary
kandi X-RAY | BusHelper Summary
公交路线查询移动应用系统 - QPython webapp sample.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of BusHelper
BusHelper Key Features
BusHelper Examples and Code Snippets
Community Discussions
Trending Discussions on BusHelper
QUESTION
I'm using Masstransit and RabbitMQ to publish events(without a consumer, only using a publisher), and at the moment i'm trying to create a integration test to verify that the message has been published, and if so, i want to check if it is the right message. To do that i create a consumer to consume the message from the queue and compare it to what i expected. The problem here is, i cant consume the message. The event is successfully published but im not able to get the message.
This is the class responsible for connecting the Consumer
...ANSWER
Answered 2017-Jan-22 at 13:02- You need to start the bus by calling
bus.Start()
. You do not do this so nothing is received anyway. - It is unclear what
transportClient.CreateTransportAsync
does. Who is publishing the message? - Consumer is instantiated per consumed message. What you do in your "test" - you instantiate an instance of the consumer and keep reference to that instance. Then you send a message somewhere. MassTransit creates a new instance of your consumer, you get the field updated, then the instance gets disposed. But you are checking the
Result
of the instance you have originally created, which is never receiving any message. It will always benull
. - Delivering message from publisher to consumer takes time. You are trying to check the result straight after you initialise the bus. I am quite sure you will never get it so fast, even if you fix (1), (2) and (3)
I am not sure what exactly are you trying to test. Publishing and consuming messages work over all transports with MassTransit. You can get any sample from Github, build it, run it and see it working.
There are also a number of tests for the RabbitMQ transport that show how you can create something like this. For example, check the ConsumerBind_Specs.cs file.
In addition, if you want to use some existing consumer instance, you can connect this instance to the bus as described in the documentation Connecting an existing consumer instance. Using e.Instance
instead of e.Consumer
will make your test work of you do proper waiting for the Consume
method to finish. However, this is not really popular approach since you really want to limit your consumer scope to one message handling only.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install BusHelper
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page