design the flow of connecting my app to message broker - asynchronous

I want to write an SMS bulk app. using .net core webapi app and rabbitMQ.
now, the end user want to send a message to huge number of cellphones.
I guess can do it using two flow.
is it correct? has another solution? or bether solution?
I guess the green flow is better because the user waiting is less than red flow?
maybe you say this two flow totally wrong. and I need another solution. can any one help me!

You need to break your problem down, without getting to your selected technology first.
Question:How much traffic you are required to terminate per second
Question:How much traffic sms-api(SMS Provider) can handle per second
Question:How much traceability you need per message, is the log enough or you need a permanent storage
I believe after answering these questions you would be able to have a rough idea about the design of application

Related

Schedule a conditional email message with Akka.Net

I need to implement the following logic - I send a message to the user, and if he doesn't reply, I send it again after 12 hours.
I wonder what is the best way to do this? I was thinking about using Akka.NET - after a certain amount of time the actor would check if the user replied to my message and if not, would send it again.
Is there maybe an easier way? If not, there are some questions for Akka.NET
Do you know any good sources where I can see how this library should be used in ASP.NET Core? The documentation is not clear enough for me.
Where to keep the actors and the logic associated with them? In a separate project? Where can I create an actorSystem?
I'm new to this topic, thank you in advance for all the answers.
I theory you could just use standard actor system schedule a message order to resend an email after 12h, but this has natural problems with a fact, that if your process will crash, all of its in-memory state will be lost.
In practice you could use one of two existing plugins, which give you durable schedules:
Akka.Persistence.Reminders which works on top of Akka.Persistence, so you can use it on top of any akka.net persistence plugin.
Another way is to use Akka.Quartz.Actor which offers dedicated actors on top of Quartz.NET and makes use of Quartz's persistence capabilities.

android - Background service

I am writing android application which will request the data from the server after every 5 minutes and will load it into the sqlite. Later on, the data from the sqlite will be displayed to the user whenever he wants to view the data. Database will contain only the data up to last 2 days and will keep deleting the older data.
I want to achieve all this functionality using Firebase JobScheduler. But before writing, I want to know if it is the right tool to go for? Is there a better way to achieve this functionality? Or any recommended way?
Thanks in advance.
Your implementation plan sounds OK to me. But I think synchronizing every 5 minutes is excessive and will cause problems for your users from constant battery drain and network usage.
You implementation is right but there is a huge drawback in this mechanism i.e. battery drainage. I think the best mechanism would be if you implement that functionality on server end.
Server checks that if there is any change in the database
If it finds any change then you just need to push the specific updated data to your mobile agent.
Advantage:
1. You dont need to worry about the battery on mobile agent
2. All the hard work and calculation is done on server end.
Enjoy !!

Dynamically set Receive Pipeline- Biztalk 2016

What I'm trying to do is set up a decoupled/flexible framework/strategy for all applications I develop in the future, that includes as much 're-use' as possible. Preferably what I'd love to have in the end is a single orchestration that I can 'plug-in' to any other orchestration which will take a message and send to a send adapter and return the response to the calling orchestration (having converted the received response to XML dynamically based on the constructed message to the adapter). This would require being able to set the receive pipeline on the message in the orchestration.
Am I on the right track here? I can't find much on what the best practice is in regards to artifact re-use in BizTalk.
Such comes up from time to time and I can tell you, it just never works out. You will spend a lot of time building essentially a framework, only to never actually use it beyond a handful of situations.
Meaning, no one tries this anymore because it was never actually useful. You might want to look at the ESB Toolkit, but even that almost always makes things more complicated than needed.
If you describe some of your scenarios, we can give the best advice.

How to handle network calls in Microservices architecture

We are using Micro services architecture where top services are used for exposing REST API's to end user and backend services does the work of querying database.
When we get 1 user request we make ~30k requests to backend service. We are using RxJava for top service so all 30K requests gets executed in parallel.
We are using haproxy to distribute the load between backend services.
However when we get 3-5 user requests we are getting network connection Exceptions, No Route to Host Exception, Socket connection Exception.
What are the best practices for this kind of use case?
Well you ended up with the classical microservice mayhem. It's completely irrelevant what technologies you employ - the problem lays within the way you applied the concept of microservices!
It is natural in this architecture, that services call each other (preferably that should happen asynchronously!!). Since I know only little about your service APIs I'll have to make some assumptions about what went wrong in your backend:
I assume that a user makes a request to one service. This service will now (obviously synchronously) query another service and receive these 30k records you described. Since you probably have to know more about these records you now have to make another request per record to a third service/endpoint to aggregate all the information your frontend requires!
This shows me that you probably got the whole thing with bounded contexts wrong! So much for the analytical part. Now to the solution:
Your API should return all the information along with the query that enumerates them! Sometimes that could seem like a contradiction to the kind of isolation and authority over data/state that the microservices pattern specifies - but it is not feasible to isolate data/state in one service only because that leads to the problem you currently have - all other services HAVE to query that data every time to be able to return correct data to the frontend! However it is possible to duplicate it as long as the authority over the data/state is clear!
Let me illustrate that with an example: Let's assume you have a classical shop system. Articles are grouped. Now you would probably write two microservices - one that handles articles and one that handles groups! And you would be right to do so! You might have already decided that the group-service will hold the relation to the articles assigned to a group! Now if the frontend wants to show all items in a group - what happens: The group service receives the request and returns 30'000 Article numbers in a beautiful JSON array that the frontend receives. This is where it all goes south: The frontend now has to query the article-service for every article it received from the group-service!!! Aaand your're screwed!
Now there are multiple ways to solve this problem: One is (as previously mentioned) to duplicate article information to the group-service: So every time an article is assigned to a group using the group-service, it has to read all the information for that article form the article-service and store it to be able to return it with the get-me-all-the-articles-in-group-x query. This is fairly simple but keep in mind that you will need to update this information when it changes in the article-service or you'll be serving stale data from the group-service. Event-Sourcing can be a very powerful tool in this use case and I suggest you read up on it! You can also use simple messages sent from one service (in this case the article-service) to a message bus of your preference and make the group-service listen and react to these messages.
Another very simple quick-and-dirty solution to your problem could also be just to provide a new REST endpoint on the articles services that takes an array of article-ids and returns the information to all of them which would be much quicker. This could probably solve your problem very quickly.
A good rule of thumb in a backend with microservices is to aspire for a constant number of these cross-service calls which means your number of calls that go across service boundaries should never be directly related to the amount of data that was requested! We closely monitory what service calls are made because of a given request that comes through our API to keep track of what services calls what other services and where our performance bottlenecks will arise or have been caused. Whenever we detect that a service makes many (there is no fixed threshold but everytime I see >4 I start asking questions!) calls to other services we investigate why and how this could be fixed! There are some great metrics tools out there that can help you with tracing requests across service boundaries!
Let me know if this was helpful or not, and whatever solution you implemented!

How do I ensure that SOAP requests from a flash client to my ASP server are coming from the flash client?

I have a flash based game that has a high score system implemented with a SOAP service. There are prizes involved and I want to prevent someone from using FireBug or similar to discover the webservice path and submit fake scores.
I considered using some kind of encryption on the data but am aware that someone could decompile the swf and work out how I did it.
I also considered using an IP whitelist but since the incoming data will come from the users IP and not the servers that won't work. (I'm sure I'm missing something obvious here...)
I know that there is a tried and tested solution for this, but I don't seem to be asking google the right questions to get to it.
Any help and suggestions will be appreciated, thank you
What you want to achieve is impossible. You can only make it harder for people to do. The best you can do is to use encryption and encrypt the SWF it self, which usually causes higher filesize and poorer performance.
The safest method is to evaluate or even run the whole game on the server. You can try to determine whether what the client sends you is possible at all. Rather than making sure people use your client, you're making sure people play the game according to your rules.
greetz
back2dos
All security is based on making things hard. It never makes things impossible. How about having your game register with a separate service when it starts up. It could use client information to build some kind of special code that would be unique for each iteration of the game. The game could morph the code in a way that would be hard to emulate. Then when the game is over the score gets submitted with the morphed code and validated on the server side.

Resources