What is the Best/preferred way of Queuing any Request in C# for Web API built on .Net 6 | C# synchronous process implementation [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 days ago.
This post was edited and submitted for review 3 days ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
Issue:
Queue the multiple requests for printing 1 at the time for given printer.
this approach is not working https://michaelscodingspot.com/c-job-queues/
as while adding request in thread it will loose the this.DBContext object.
Explanation:
There are multiple terminals/clients pc to call WEB API built on .net-6.0 which triggered the code which is responsible for printing to execute and send out the print command with object to be printed to Printer. As there are many printers are available but if any one printer is in use means If one request is printing on 1 printer then other request should not proceeds and wait till first request will finish printing and then it will take another request and process for printing like this, flow continues.
Please see below diagram.
Which is the best way to handle such scenario without using any third party DDL or any DB save of all requests and triggered it from there.
Flow

Related

Event scheduler notification [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am working on code to send an sms to customer one week before their subscription reach expiration date. I absolutely don't know how to proceed. I am coding in asp.net c# and sql server.
Create one console Application which will take user whos expiration comes in week, Then write code to fetch the user with there numbers. Then use any third party Api to send sms. you have to send parameters to this Api with your appropriate message.
Then create one job inside sql server which will run everyday which will execute your Console Application code to send SMS.
I would say, separate out publishing and subscription tasks. So in future you can do more with such customers.
Prepare a Publisher which looks for such customers and adds a task to Queue.
Write a Subscriber who watch outs for new queue items and take action.
So in future if you want to make multiple way of communicating to customer like, email then you just need to add more subscriber.
Host your logic as a .NET windows or IIS service.
Benefit: Publisher can independently perform addition.
Subscriber performs task as soon it sees something in queue.

Thread State Management in Asynchronous Programming [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am new to asynchronous programming in .Net using C#. All I have understood so far is :
With asynchronous programming, threads that are waiting for a web service or database to return data are freed up to service new requests until the data the is received.
Once the data is received, the thread is restarted and continue processing the code that comes after that call.
Now , I wanted to know in details How the state is managed for the thread so that it can start executing from the point the async call was made.
If it uses a stack to handle that, Can some one please give me an insight into the process?
Thanks,
Mayank
Now , I wanted to know in details How the state is managed for the thread so that it can start executing from the point the async call was made.
Async method are divided into smaller chunks. Basically, when compiling async method, for every await keyword new method is generated.
Keep in mind, that this is a big simplification and it's all done behind the scenes and you really don't need to know how it works in order to use it.

c# notify a running process [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to somehow notify a running process from the "outside"?
I have a C# program that theoretical runs forever. And I would like to notify it to trigger some action manually. It would be best, if this solution is possible on Windows and Linux (mono).
EDIT:
The solution should work without a user interface
My program is, as for now, a part of web service. On initializing, a new Theread is created, which uses the Task class to stay alive
Take your forever-running-process and let it provide a webservice other processes can call.
You might use any cross-plattform webservice framework like WebApi or ServiceStack to achieve this via HTTP calls. This will even work over the internet (if the machines can reach each other).
There are dozens of approaches. You could also use named pipes for example, or put commands into a database (the other process has to query regularly) or - if you're fearless enough - write/read files to communicate. Be creative ...

C#: How do I wait 10 seconds for a client to call a method? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
On a server(Web API), I have methods A and B. When method A reaches a certain point it uses SignalR to call a client method with a certain ID and then has to wait 10 seconds. If a client calls web method B with that ID within those 10 seconds then method A enters Path 1. If a client does not call method B then method A enters Path 2. Do you have any ideas on how to implement that?
Thank you,
Peter Chikov
HTTP is designed to be stateless. If possible, the server should not be attempting to keep track of the client's state. Can you change your implementation so that the client initiates a new request after the SignalR call and then enters path #1 or #2?

is there any solution for making 10000 concurrent web requests in C#? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to test my asp.net web api REST service that hosted in a HP-580dl and I want to measure the performance and response time when 10,000 simultaneous requests hit the service.
is there any way to do that in C# ?
Siege is a good tool for measuring load under concurrent requests: http://www.joedog.org/siege-home/
It's not written in C#, but there's no reason why it should be.
The Visual Studio load testing tools provide this functionality, and can control multiple agents in cases where you want a distributed profile and/or a greater concurrency level than a single client machine can support.
Create and run a load test

Categories

Resources