How to implement not-real time chat between clients in Spring - spring

I would like to understand what's the best way to implement a very simple message exchange system between two clients, using Spring Boot as back-end and AngularJS as front-end.
I'm new to Spring, I'm studying it and using it for a University project.
Let's say that my project is a kind of a simplified e-commerce. I want to create a "conversation" between two clients (for example, something like the messaging system on eBay) based on the exchange of simple text messages. If one of the clients is not connected, he has to be able to retrieve the messages received while he was offline.
I came across several tutorials and guides but most of them explain how to create a real time "chat room" which is not what I'm looking for.
I would like to have some suggestions on what would be the best path to follow (JMS, WebSocket...) and why.
Thanks in advance!

Related

How to create a self-contained service with microfrontends which needs to embed 100+ other microfrontends?

we're currently trying hard to get into microfrontends and self-contained services. I would say that we understood in some way the base concept.... But we run into a problem if we're talking about our calendar:
The calendar is for us a self-contained service with his own microfrontend, and it's including data from other self-contained services. So far, nothing special. So the idealistic way would look something like that:
Desired self-contained services
But the difference we see to other services is, that the calendar has a lot of events (especially in the month view).
So if we would go with the microfrontend approach, we understood that we have to include in every event the microfrontends from the self-contained services "employees", "patients", "treatment" etc.. But this seems for us a big performance disadvantage.
So we decided for now to solve this with an API Gateway. But now we lost the independence between the self-contained services:
Calendar diagram
Do you have some suggestions for us how to get the advantages of microfrontends & self-contained services if you have such a situation as the calendar? Or would you solve it completely differently?
Tech stack:
React for Frontend
Java Quarkus for Backend
Postgresql as Database

Is there a way to connect to Exchange Online using Logic Apps? Do I need to use a REST-api or EWS?

i'm quite new to Logic Apps. I got the task to make an auto reply function within Logic Apps that integrates with Exchange Online. Now I already performed this task using Outlook, but I have to be able to apply it to multiple mailboxes or even the entire company using Exchange. I'm about to get access to the Exchange Admin Center soon, but I don't really know how to start due to the fact that there is no simple way to make a connection to Exchange using Logic Apps. After some research, I think it's necessary for me to somehow make use of a REST API (I also read about the use of Exchange Web Services) to get the information I need, but my knowledge about this is quite small. I guess I'm gonna have to use a program like Postman to request information, so that I can start creating Custom Connectors to Exchange. If anybody has some understanding about this, feel free to reply and help me out! I will forever be gratefull!
There are several different approaches you could take to this if you (or probably they in your case) want your logic app to do all the work then you should use the Graph API rather then EWS (while its possible because its older API you'll loose marks on your assignment) have a look at http://martink.me/articles/using-microsoft-graph-in-logic-apps which covers the basics of what to do. To Get access to mailboxes tenant wide then you need to assigned Application Permission and get certificate (and store that in the KeyVault on Azure etc).
You can do this using Inbox Rules https://learn.microsoft.com/en-us/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0&tabs=http and the Exchange Server will do all the work when it comes to doing the Auto-response (and has loop detection logic already) and your logic app then just need to do the Creation and management of the Rules.
But I would suggest you clarify with the person who assigned you the task whether they want the logic app to do the response (eg using the Graph API) or if its okay for the Exchange Server to do this for then (which should be more reliable).
You can also create Rules via the Exchange Admin Center and you could probably also through in Power Automate into the mix to do Autoresponse's so I'd clarify what they want so you don't waste time building something they don't want.

Security concerns using Spring as backend for mobile app

Me and a team built a small "meet people" app last semester that used Spring linked to a MySQL database as the backend. I am working on my own app now and I'm worried about security because all of our user information was sent over HTTPS GET requests to the server. It seems weird to me that we were able to hop on google chrome, type in xxx.xxxxx.xx:xxx/user/2 and get back a JSON with all of a specific users information. If anyone knew our url/port, they would be able to access this information themselves.
I'm sure this is a basic question, but what steps do I need to take to create a Spring backend that isn't as easy to access? I'm basically a total beginner in this, but I did write the service in Spring last semester so I know the basics.
You can use Spring Security which is a very good project and easy to integrate.
There are many types of security features it provides :
Basic Spring Security
Role Based Spring Security
baeldung.com and howtodoinjava has a very good series on it.
You can also use jwt-authentication-on-spring-boot which is also a good way to secure the APIs.

How to find all users subscribed to a topic in spring websockets

When making something like a chat application using Spring Websockets, it is useful to know who all is subscribed to any given topic. For, e.g. presence data displayed in the clients.
I know that I can implement ApplicationListener and keep my own list of "connected users", but it seems like the library must already be doing this work.
What's the recommended way to get active subscription info from the library directly (and without maintaining my own list in memory or db).
You're right, you could use ApplicationContext events, but unfortunately those events deal with user sessions events and broker events - so you won't be notified when a user subscribes to a particular topic.
You could do that when using the SimpleBrokerMessageHandler, by getting the SubscriptionRegistry. But again, the SimpleMessageBroker is not for production use.
If you're using RabbitMQ, you can get that information from its REST API.
The thing is, this is very specific to the broker implementation, so I'm wondering if a feature like that makes sense in Spring Framework. Could you open a JIRA issue to start the discussion?

Web application control through text messages

I want to develop an application that works by receiving text messages from users to gather data. I have no clue where to begin and what to begin with. I can code in Python, C++, PHP and can do Java also.
I was wondering if there can be a personal development setup or framework on which I can develop such application. Releasing it is a different story but I do not have any idea about what setup is needed to develop this application.
Also, how much would this setup cost? Are there open-source or any other cheap alternatives?
There are a lot of services out there that let you receive SMS via a web request. The one I work for Twilio will send you a simple POST request to a URL of your choice containing To, From and Body whenever you receive an incoming message. You can read more about how it works here.
This service offers an api for receiving text messages. You can use the shared number and send it to your server with a keyword or you can pay a monthy fee to have your own dedicated number. So there would be a good place to start.

Resources