Extending ManagedPerformanceCounter - apache-camel

I have been trying to add my own performance counter, and I'm unable to use this performance counter for my routes.
Could anyone tell me how to use a custom performance counter instead of ManagedPerformanceCounter?
Thank you.

if you are looking for a JMX solution...you can register a processor and use custom APIs to retrieve stats...
http://camel.apache.org/why-is-my-processor-not-showing-up-in-jconsole.html
also, here are some notes on using JMX to retrieve route stats...
http://benoday.blogspot.com/2010/08/managing-camel-routes-with-jmx-apis.html

Related

Use Vue3 components/routing in AngularJS project

My task is migrate incrementally from AngularJS to Vue3. The idea is to start using Vue components in some places, rotes, server requests.
Is someone has success story using Vue3 components/routing in AngularJS project?
I've spent few days trying make it work, but in internet there is no example about it. Only Vue2/AngularIO, Vue3/AngularIO, Vue2/AngularJS, etc.
Not sure what more information I need to provide.
Thanks in advance!
I think one good way to achieve such a complex migration would be to borrow some principles from the microfrontend architecture principle.
Just divide your application in big components, that you would like to convert one by one.
Take a big component of your application, rewrite it in VueJS, and make it communicate to the rest of your application using custom events.
That will allow you to work incrementally, without using any additional component or library to make the transition.
Just be sure to define clearly the boundaries between your different components, and don't try to apply this approach to very small components (as there will be some overhead involved by adding this event communication).

Need a way to write custom metrics in my flink program

I need to know the way to implement custom metrics in my flink program.
Currently, I know we can create custom metrics with the help of RuntimeContext.
But in my aggregate() I do not have RuntimeContext. I am using window operator and applying aggregate() method on it. And I am passing AggregateFunction in aggregate() method.
So, Kindly guide me, how can I create custom metrics in my code?
Note: As we know we can not user RichAggregateFunction with aggregate() method
If your goal is to update a metric with every element, I think you'll have to implement a custom window operator in which you override the open and processElement methods.
It's not generally recommended to get involved in the operator internals, but sometimes it's the only way to get access to interfaces you need that are otherwise hidden.

What is the difference between the methods process(Exchange) and process(Exchange,AsyncCallback)

I am trying to write a custom intercept strategy
What is the difference between over riding the method process(Exchange) by using a processor or over riding the method process(Exchange,AsyncCallback) using a AsyncProcessor.
When one i do i need to use.?
If you have a copy of Camel in Action book then its best explained there in chapter 10. You can also find some details on the Camel web site, and the javadoc.
http://camel.apache.org/asynchronous-processing.html

Which one to use in Angularjs : Factory, Service and Provider?

Hi I am new with Angularjs. I am reading about Angular service. I have read the following
what-is-difference-between-factory-service-and-provider and service-vs-provider-vs-factory. To me, it seems like they are just different way of achieving same goal (please correct me if I am wrong.) Now I am wondering as they all serve the same purpose which one is idea to use and considered as best practice?
Sounds like the question is when to use which. First it's important to note that they are all providers. Each is a more specialized version of the other starting with provider. factory is a specialized version of provider. value and service in turn are specialized versions of factory.
And constant and value are specialized versions of each other. Because provider is at the top can therefore can do what all the other providers do you could get away using just providers. But you would be writing a lot of unnecessary code.
Each specialized provider down the chain, if you could use it would allow you to accomplish the same thing in less code. So you could say the best practice is to use the provider furthest down the chain that accomplishes what you wanted.
Here is a high level image showing you what I mean:
(source: simplygoodcode.com)
And below is the link to the blog post the image is from that gives you additional examples:
http://www.simplygoodcode.com/2015/11/the-difference-between-service-provider-and-factory-in-angularjs/
There is no best practice, no one is going to tell you that one is better than the other (service vs factory).
Use a provider if you need to configure your service at run time (like you configure your router for example).
To when to use a factory or when to use a service, they are the same.
Factory has the easiest syntax to understand (using reveal module pattern) so that is the most common choice.
On the other hand, services are now more "useful" because they use the same syntax as the Angular 2 services, so if you plan in migrate someday, using services now will help the transition.

How to route custom Java Listener onEvent using Camel

I haven't been able to find any examples that help me understand what I need to do here, so I'll explain my problem:
I have a Java Bean that implements a custom listener for Pivotal's Gemfire product. It implements an interface known as CqListener, which defines a method as follows:
public void onEvent(CQEvent evt){
...
}
Basically, when we execute a Continuous Query (CQ) on the Gemfire grid, we register this Bean as a Listener that will receive any change in the grid that matches our query.
For example, executing a CQ like
SELECT * FROM /table_name
will give us a CQEvent in the onEvent method whenever anything in the 'table_name' table (in Gemfire it's called a region though) changes (CRUD)
What I am now trying to do is wire up Camel to route anything from this underlying CQ stuff to a custom route. Is there anyway I can tell Camel to say "Hey, anytime a call is made to onEvent, take that and route it somewhere else" ?
The somewhere else I am trying to route to is an Akka Actor. There already is a project that wraps akka and camel (http://doc.akka.io/docs/akka/snapshot/scala/camel.html) but I can't figure out this Endpoint URI business to get the inbound CQ events.
I know I am missing a conceptual key regarding Camel, so any help is greatly appreciated. I have managed to implement this using a jms endpoint, so I get how it works for the well known protocols, but I'm just trying to figure out how to do this for custom protocols where the implementation is abstracted away from me (As is the case of CQListener)
I added the "spring-integration" label to your post. Someone from the Spring Integration team may have more experience, or ideas with regard to this sort of problem.
Also, Spring Integration's GemFire Suppor documentation specifically, and surrounding documentation in general, may give you additional ideas, or options.

Resources