i'm trying to write a windows service firing custom events sending Specific strings. These strings should update a monitoring form (different app). While debugging, i notited that the external app isn't subscribed for receiving those events. I searched the internet but don't know where to start. All articles I found with this kind of problems are looking slightly different.
In Short:
App1 is a windows service firing events
App2 is a windows form that should receive these events and display received messages.
Where do I start
.NET events are events that fire within a process (app-domain) - you can't subscribe to events in one process from another.
You need to look into some form of IPC - WCF is a good choice.
Related
Customers... Have to love them :)
I built out a web process that starts a live stream in Azure Media Services, but in testing I've seen a couple of times where the end user just closes the browser instead of clicking the end broadcast button I've so nicely set up for them.
The problem then is obvious, the stream keeps on running. Multiply this a few times and I've now got numerous live streams broadcasting nothing but I'm incurring costs.
Is there anything in the configuration in the portal (or even in the stream configuration: client.LiveEvents.CreateAsync(....) ) that can stop these services even if they close off their browser?
A few ways to approach this.
Your web application should prompt the user if they want to end the broadcast if they are closing the browser. This is a browser event that your web application can handle.
From the server side, you can monitor live events by subscribing to eventgrid events. 2 ways to do this as well. Please see the documentation on the eventgrid event schema to learn more about them.
You can either subscribe to the stream level "Microsoft.Media.LiveEventEncoderDisconnected" and monitor that no reconnection come in for a while to stop and delete your live event.
Or you can subscribe to the track level heartbeat events. If all tracks have incoming bitrate dropping to 0; or the last timestamp is no longer increasing, then you can also safely shut down the live event. The heartbeat events come in at every 20 seconds for every track so it could be a little bit verbose.
To learn more about how to subscribe to eventgrid events, you can read this documentation here
There is requirement in project and the windows service needs to be used as subscriber of RabbitMQ (message broker).
Once the event has created, this listener windows service get the event and process the event, while processing, there are some important business logics needs to be incorporated and the data needs to be stored into SQL server DB.
From my perspective, windows service can be just a trigger of any business logic. Like once it subscribed to an event, if any event comes, read the event details and perform the business logic using any of the REST (HTTP based) service.
Please provide your suggestions, it would be more helpful. Thanks in advance.
You need to create a Windows application using c# or you can use NUGET rabbitmq client to consume message and save in dB.
https://www.nuget.org/packages/RabbitMQ.Client
I'm trying to figure out a portable way to develop a custom but scalable task queue in my cluster for google container engine . This is the scenario I have a front end that captures users details in my node js instance ,these details are sent to the api system which in turn contacts the db ,saves the user details and is expected to send a welcome mail .
My issue is this i don't want to use the same api endpoint method to process the sending mail requests ,I need another process to handle that how do I handle that with my kubernetes infrastructure?.Do I need to implement a pub sub type of system to publish to another container ?.If I do this it means all subscribes will be notified of my update but what if I have 2 instances of my sub system running it means they will all observe the changes and send the mail twice. Any thoughts or ideas on this would be appreciated.
I see two reasonable ways to approach this.
1: have a service that takes in mailing events by means of an API and returns immediately after receiving to process mailing asynchornously. Using kube service you will hit only one such service and one mail will be sent in a non blocking way for the calling service, but it has downsides - ie. what happens if something fails, the mail might not be generated at all.
2: I would go for some MQ probably (Kafka, Rabbit etc.), have a message queue consumed by any number of mailing service instances, make sure that only one can pick up the message, and require an ack for the message or return it to processing if no ack in N min
I'm a bit new to MSMQ and need a bit of help. We have a JMS based messaging system and we are considering replacing it with MSMQ. There are 2 existing scenarios in JMS which i need to verify MSMQ supports.
Multiple Subscriber Applications for the same message.
Notification send to a Subscriber Application that a message has arrived for them. (Basically MSMQ pushing message to the subscriber application as opposed to the Subscriber application checking the Queue in MSMQ)
If anyone could provide any info or link to any sites with the relevant info, I'd appreciate it.
Thanks,
Tarique
Multiple Subscriber Applications for the same message.
You can do this with Multiple-Destination Messaging
Notification send to a Subscriber Application that a message has arrived for them.
Use async pattern for this, you begin listen for a message and get notification when it arrives (C# method, such as MyReceiveCompleted in the code sample). From personal experience this works slower than reading one by one in a sync way. But if you handle less than 1k messages a second on an arbitary average machine you will be fine.
See MessageQueue.BeginReceive for code sample.
I am builing a win application that has user access control against a sql db, all the data is stored in this db as well.
This project is to be installed in one site on 30-40 machines (I mean to say that it's not web, it's all in one place, maximum call it intranet).
I want that while the program is logged on, the logged-in user should be able to chat to the other logged in users.
Any recommended approaches in C# & VB?
I would appreciate any idea, link or tip.
Please share me with your experience
Thanks!
NOTE: The program is in Wpf if it does matter.
Architecturally, it seems like a publisher-subscriber message bus would be a good pattern for you. You would have a centralized server that each client would register with that will distribute notifications from publishers to subscribers.
Each client will register for notification of the client list upon starting. Each client can register interest in being notified when another client publishes a message. Each client would publish messages to the bus to be delivered to any subscribers for that client.
There is a good example of a pub-sub message bus written in WCF in MSDN: WCF ESSENTIALS What You Need To Know About One-Way Calls, Callbacks, And Events. You could get this up and running fairly quickly.