I cannot understand why sometimes my spring boot (version 1.4.1) application based on spring-boot-starter-tomcat and spring-boot-starter-websocket stops working.
Specifically my application provides is meant to provide to the client some real-time events about system status. These events can be both periodical or in response to user input and events are sent by means of the SimpMessagingTemplate's convertAndSend method.
Sometimes all events stops working but I cannot find any evidence in logs: nor exceptions neither BrokerAvailabilityEvents saying that the Broker failed.
I have no idea of how to fix it.
It turned out that SimpMessagingTemplate's convertAndSend method was not called because the thread that was responsible for calling it on behalf of an event was stuck and froze all event notification chain.
Related
In my Quarkus app I get Enlisted connection used without active transaction errors around once a day (on a public API used quite a lot).
It seems to come from Agroal (here https://github.com/agroal/agroal/blob/master/agroal-pool/src/main/java/io/agroal/pool/ConnectionHandler.java#L393).
According to the stack trace it fails at various places in REST endpoints annotated with #Transactional.
In PostgreSQL I only get the following:
ERROR: canceling statement due to user request
I worked around this issue by firing an event which is listened in a TransactionPhase.AFTER_SUCCESS method (and this method send the Kafka message).
I'm developing a publish subscribe processor with Eclipse Milo for Apache NiFi.
I have a service that handles most of the interaction with Eclipse Milo and the server and a controller that essentially just calls the service's functions.
The subscribing to nodes on the OPCUA server works fine, but I can't think of a good way to terminate the subscription, e.g. when I stop the processor.
The subscription, which "lives" in the service, survives the service getting disabled, as well as the controller being disabled/stopped. That means that the #OnStopped & #OnUnscheduled methods that I defined never get called, likely because the subscription never gets terminated. So I can't use these two methods.
I know that I can terminate threads in NiFi 1.7+, but I don't think that's a good way to handle this and also I'm still using 1.2.
Does anyone have any suggestions?
Update to the latest version, some problems with the way processors finish were fixed.
I am new to Microservices and have a question with RabbitMQ / EasyNetQ.
I am sending messages from one microservice to another microservice.
Each Microservice are Web API's. I am using CQRS where my Command Handler would consume message off the Queue and do some business logic. In order to call the handler, it will need to make a request to the API method.
I would like to know without having to explicit call the API endpoint to hit the code for consuming messages. Is there an automated way of doing it without having to call the API endpoint ?
Suggestion could be creating a separate solution which would be a Console App that will execute the RabbitMQ in order to start listening. Create a while loop to read messages, then call the web api endpoint to handle business logic every time a new message is sent to the queue.
My aim is to create a listener or a startup task where once messages are in the queue it will automatically pick it up from the Queue and continue with command handler but not sure how to do the "Automatic" way as i describe it. I was thinking to utilise Azure Webjob that will continuously be running and it will act as the Consumer.
Looking for a good architectural way of doing it.
Programming language being used is C#
Much Appreciated
The recommended way of hosting RabbitMQ subscriber is by writing a windows service using something like topshelf library and subscribe to bus events inside that service on its start. We did that in multiple projects with no issues.
If you are using Azure, the best place to host RabbitMQ subscriber is in a "Worker Role".
I am using CQRS where my Command Handler would consume message off
the Queue and do some business logic. In order to call the handler, it
will need to make a request to the API method.
Are you sure this is real CQRS? CQRS occures when you handle queries and commands differently in your domain logic. Receiving a message via a calss, that's called CommandHandler and just reacting to it is not yet CQRS.
My aim is to create a listener or a startup task where once messages
are in the queue it will automatically pick it up from the Queue and
continue with command handler but not sure how to do the "Automatic"
way as i describe it. I was thinking to utilise Azure Webjob that will
continuously be running and it will act as the Consumer. Looking for
a good architectural way of doing it.
The easier you do that, the better. Don't go searching for complex solutions until you tried out all the simple ones. When I was implementing something similar, I was just running a pool of message handler scripts using Linux cron. A handler poped a message off the queue, processed it and terminated. Simple.
I think using the CQRS pattern, you will have events as well and corresponding event handlers. As you are using RabbitMQ for asynchronous communication between command and query then any message put on specific channel on RabbitMQ, can be listened by a callback method
Receiving messages from the queue is more complex. It works by subscribing a callback function to a queue. Whenever we receive a message, this callback function is called by the Pika library.
In NServiceBus 3.0.3 I have written a saga. Based on what I'm seeing in the CQRS paradigm, when we see past tense, that should coincide with an event. I want to make sure I don't have business logic in my saga. My assumption in building the saga is that it would receive events and issue commands based on the event that came in as well as certain data elements stored on the saga. The issue I'm running into is that the Saga by default cannot subscribe to published events. I've tried in the EndPointConfig setting up the IWantToRunAtStartup and in the Run method executing
Bus.Subscribe<CustomerBilledEvent>();
I've tried creating a handler in the same assembly with saga and still no dice.
My app.config for both the saga (hosted by Nservicebus.host.exe) and the publisher (a service in a console application) both have the message endpoints configured as such
<add Messages="Events.CustomerBilledEvent, Events" Endpoint="orderservice"/>
IHandleMessages has been configured on the Saga as well as the mapping has been configured on the orderid.
IHandleMessages<CustomerBilledEvent>
ConfigureMapping<CustomerBilledEvent>(s => s.OrderId, m=> m.OrderId);
I'm a little lost as to why I can't get the Saga to subscribe to this event. I understand they do not auto subscribe by default but when I look at samples under Udi and John's blogs, I see past tense being sent (IEvent?) to the saga and them issuing Bus.Send which I infer to be commands (ICommand).
So the problem is that you've set it up that your saga is trying to subscribe to the "orderservice" endpoint to be notified about the CustomerBilledEvent, but that endpoint isn't publishing it.
I have an application that must log all events that the user does in a remote database, so,I´ve choice to use the webservice format (the application call the webservice with the event parameters).
So, i did a remote EJB to perform that, but it is running with a bad performance, because the application needs to wait for the webservice´s response to proceed the request.
Is JMS an alternative?
What you suggest?
Thanks.
JMS will be much lighter & can asynchronously process the events. They can be used to capture application events or audit logs for the activities occurring in the system. Can send a message to a queue with proper details & those can be fetched at receiving end to process further.
If you are using EJB-3.1, then can annotate your method with #Asynchronous which returns AsyncResult implementation of Future which can be used to retrieve result, but can also be used with methods returning void.