How to check that user can write to JMS queue / topic? - queue

How is it possible to check that particular user has write rights to Queue / Topic, without affecting Destination.
If user has no such rights exception will be thrown and there would be zero-affection.
But if user has such rights, then new message will appear in Queue / Topic, and this is that shouldn't occur.
Is there any way to perform such test? May be is it possible to use transaction without commit?

I think generally, it will depend on the JMS provider that you're using, as JMS itself does not specify security mechanisms. On IBM MQ, for example, calling Session.createProducer(Destination queueOrTopic) will throw an InvalidDestinationException if you're not authorized to send/publish messages to a destination.

Related

Sync data from REST and Websockets

we are building chat application similar to messenger. There is required behavior:
User log in
User should see last N messages, and he should be able to load older messages
New messages should be appended as well
My solution:
I would like to use websockets for this purpose with combination of REST. My idea was that client application decide by message id which messages need. So REST will be used for initial fetching of messages and fetching older messages.
New messages will received by websockets
Possible issue which I should handle:
Application starts subscribing websocket channel for new messages and send request for old messages without initial message id
There is chance that after calling GET request new message come, and will be stored in DB
Client application started subscribing websocket channel so message will received by websockets.
GET request didn't know about this message and fetch last N messages where this new messages will occured and client application will have duplicate record and have to filtered this messages
Can you give me advice if there is some elegant way how to handle this case? Thank you.
I would resolve your task having in mind the following:
The client application should know only about the topic to which to listen. And not the ID of the message starting from which to listen.
It is up to the server to decide what to return (even time should always be tracked server-side).
The WebSocket is used as a transport for STOMP (simply to not reinvent the wheel). The WebSocket connection could be opened once the client application is loaded and not when it is entering the "listen for messages" state. But topic subscription should be performed when necessary.
You can always send GET request and initiate a STOMP subscription simultaneously (almost simultaneously, well with a delay of 1-2 nano-second). And those always should be processed in different promises. But I would align those in the following way: first, the STOMP subscription is initiated, And a specific message on subscription with the initial timestamp of the start of subscription is delivered; second, REST request to get previous 10-100 messages for the TOPIC prior to a specific timestamp (received from STOMP) is performed.
Getting the last 10 messages (which are prior to subscription moment) could be delivered as by REST as by STOMP approach: you can always react to a subscription event on your server-side, and deliver client-specific messages.
Regarding the problem of multiple identical messages from different "data channels", it is easily resolvable: your client (hope that is not jquery, but rather Angular or React or Vue or anything else) will be storing all the data in a single collection in a controller, and filtering and checking by message-id that only unique entries are stored is easy.
BUT if your system will produce hundreds of thousands of messages per second: I guess HTTP-based protocols are not your choice in this case.

How can I assure consistency when using an event-carried state transfer approach in Kafka

Let's suppose a simplified scenario like this:
There are two Kafka topics, users and orders and three microservices user-service, order-service and shipping-service.
When an order is placed through the order service, an OrderCreated event is added to the orders topic and listened by the shipping service. This service needs to get the user information to send the order. According to my requirements I can't make a REST call to user-service but use a stateful approach. That is to say, the shipping service is a Kafka Streams application that listens to the users topic, having a KTable backed by a local store with the full user table information. Thus, when processing the order it already has the user information available locally.
However, one concern of this approach is the consistency of the local user information in the shipping service, e.g:
A user updates its shipping address in the user-service, it updates its local SQL database and publishes an event in the user topic with this change.
The user places an order, so order-service publishes it in the order topic.
For whatever reason shipping service could process the OrderCreated event from order topic before reading the UserUpdated information from the user topic so it would use an address which is not valid anymore.
How could I guarantee that the shipping service always has an updated user information in this event-carried state transfer scenario?
If you need ordering guarantees, you would need to write both the user information update as well as the order into the same topic (and in particular into the same partition) because Kafka only guarantees order within a single partition.
You could call this topic "user_action" with a unique user-id as key (both an user information update as well as an user order is an user action). In your case, all three services would consume the "user_action" topic. While the user service only considers user updates and the order service only considers orders, the shipping service considers both.
This blog post might help, too: https://www.confluent.io/blog/put-several-event-types-kafka-topic/

Mirth Connect Solution.For multiple user Access info with what they Done with there name and date

my mirth connect uses 10 people simultaneously
EX . one reprocoss hl7 message and another user Remove Message.
So i want to which user will which process with time and date and ip address
plz suggestion it important
The commercial version of Mirth Connect supports advanced user management and advanced alerting, which sounds like what you need.
From the Mirth Site:
Advanced Alerting
Advanced Alerting provides metric, exception, and state-based monitoring of channels and connectors. Additional features include automatic escalation and de-escalation, scheduling, and notification throttling. Using advanced alerts, dynamically send different alert messages to different user groups based on the current escalation level, time, and day. The new alert dashboard provides a view of all alert statistics and logs.
User Authorization
User Authorization provides role-based access control to all aspects of the Mirth Connect Administrator. Create new roles with specific permissions to areas such as channel management or message browsing. Assign any number of roles to users. Use this to manage access to sensitive channel and messaging data across your enterprise.

Logging who purged a queue in MSMQ

I'm looking for a way to know who/what purged a queue (specifically Errors queue) in MSMQ. I know that messages were purged because they end up in "Transactional dead-letter messages" with the Type set to "Acknowledgement QueuePurged". But is there any way to know which AD user (or process?) triggered this? Nothing seems to be logged in Event Viewer.
There will be nothing in the security event viewer as there is no auditing enabled by default.
Auditing Message Queuing Objects

RabbitMQ Structure For Private Messaging

I am currently looking to buildout a messaging service where users can send and receive messages privately between each other. I may have a need for multi-user chat, but for the most part, I only want single recipients to be able to read messages sent to them.
With looking at RabbitMQ, does it make sense to use one exchange, and create a queue for each user when they login and destroy each queue on logout? Are there major performance issues with creating a queue for each user or are there better alternatives?
I am building a REST API and plan on having users send messages to others through an endpoint (/send) and subscribe to their own message streams via websockets or something similar. I will probably store messages in MongoDB as well, so users can access all of their previous messages. Any suggestions on structure are appreciated.
I think your approach is correct. You event don't need an exchange if you will use the default exchange (AMQP Default). And during login create a new queue and keep queue name same as user name. (Just need to make sure user names are unique) And if you publish message to the default exchange with username (ie: queue name) as routing key, RbbitMQ will route that message to that queue only. And on logout if you delete the queue then user is going to miss the messages when he is not online. If it is OK then create queue after login and use the configuration exclusive which says queue gets deleted when there is no consumer. But if you want to keep offline messages then you need to create queue permanently during user signup.