Re: Adding JMX reporting and control to dynamic router eip component

2024-01-06 Thread Steve973
I have an update if anyone can provide some insight.  I have been debugging
through the stack when I call camelContext.addService(instance), and I see
why my @ManagedResource class is not getting picked up.  As a quick
indirectly related side point, this makes me wonder why my
other @ManagedResource class *is* getting picked up!  But, first things
first.  The Introspector class is looking to see if there is an MBean
interface for the ManagedService class that is being inspected.  The name
of the interface that is being passed into Introspector.implementsMBean()
is org.apache.camel.api.management.mbean.ManagedServiceMBean, and that
seems like it should satisfy the requirements.  For the comparison, the
"clName" value that is passed in
is org.apache.camel.management.mbean.ManagedService, and it took me several
minutes of staring before I realized that the "api" part is missing from
the package name.  The method adds "MBean" to that name, then the two
string values are compared.  Naturally, they do not match, so this is never
registered as an MBean.  In the Zulip chat, I posted a screenshot of the
values, and the debugger showing that the comparison has failed, and fallen
through to the "else" block.  You can see my comment here:
https://camel.zulipchat.com/#narrow/stream/257298-camel/topic/JMX.20with.20ManagedResource.20and.20ManagedAttribute.20problem/near/411505238
if you want a visual representation of what I just tried to explain.  I
don't know how I could be causing this, or if there's any way that I can do
something different that will allow the comparison to pass.  Please let me
know if anyone can offer any insight here.

Thank you,
Steve

On Thu, Jan 4, 2024 at 4:16 PM Steve973  wrote:

> Thank you.  This helped get me much further in this effort.  The thing
> that I am having problems with, now, is that when I annotate the class
> with @ManagedResource, and then include @ManagedAttribute to methods, it
> will not show up as an MBean.  If I remove the @ManagedResource annotation
> from the class, I can get it as an MBean, but I cannot see any of the
> things I designated as @ManagedAttribute when I get the service and get its
> attributes.  Do you have any ideas about why this could be happening?
>
> Thanks,
> Steve
>
> On Wed, Jan 3, 2024 at 5:32 AM Claus Ibsen  wrote:
>
>> It needs to be added as a service.
>>
>> in the producer you can do something ala
>>
>> doStart
>>
>> ControlService cs = new 
>> context.addService(cs);
>>
>> And remove the service in doStop
>>
>> See for example SendProcessor, or do a
>>
>> git grep "addService("
>>
>> And look in the code for other examples
>>
>>
>> On Wed, Jan 3, 2024 at 10:57 AM Steve973  wrote:
>>
>> > An instance is created in the control producer.  How should it be
>> created
>> > in order to be managed?
>> >
>> > On Wed, Jan 3, 2024, 3:59 AM Claus Ibsen  wrote:
>> >
>> > > Hi
>> > >
>> > > You should not overwrite start and stop methods. But implement
>> doStart /
>> > > doStop if you need any logic.
>> > >
>> > > And how do you create DynamicRouterControlService in the first place
>> > >
>> > > On Tue, Jan 2, 2024 at 11:40 PM Steve973  wrote:
>> > >
>> > > > Hi, all.  I was talking about this on the users list, but I found
>> out
>> > > about
>> > > > the dev list, so I wanted to share this question with fellow camel
>> > > > devs/contributors.
>> > > >
>> > > > I am adding JMX reporting and control to my dynamic router eip
>> > component
>> > > > (not the original dynamic router that you can use with the DSL in
>> > > core).  I
>> > > > have two services that I annotated with camel-management
>> annotations:
>> > > >
>> > > > For JMX control (things removed for brevity):
>> > > >
>> > > > @Converter(generateBulkLoader = true)
>> > > > @ManagedResource(description = "Dynamic Router control operations
>> > > service")
>> > > > public class DynamicRouterControlService extends ServiceSupport {
>> > > >
>> > > > private final CamelContext camelContext;
>> > > >
>> > > > private final DynamicRouterFilterService filterService;
>> > > >
>> > > > public DynamicRouterControlService(CamelContext camelContext,
>> > > >DynamicRouterFilterService
>> > > > filte

Re: Adding JMX reporting and control to dynamic router eip component

2024-01-04 Thread Steve973
Thank you.  This helped get me much further in this effort.  The thing that
I am having problems with, now, is that when I annotate the class
with @ManagedResource, and then include @ManagedAttribute to methods, it
will not show up as an MBean.  If I remove the @ManagedResource annotation
from the class, I can get it as an MBean, but I cannot see any of the
things I designated as @ManagedAttribute when I get the service and get its
attributes.  Do you have any ideas about why this could be happening?

Thanks,
Steve

On Wed, Jan 3, 2024 at 5:32 AM Claus Ibsen  wrote:

> It needs to be added as a service.
>
> in the producer you can do something ala
>
> doStart
>
> ControlService cs = new 
> context.addService(cs);
>
> And remove the service in doStop
>
> See for example SendProcessor, or do a
>
> git grep "addService("
>
> And look in the code for other examples
>
>
> On Wed, Jan 3, 2024 at 10:57 AM Steve973  wrote:
>
> > An instance is created in the control producer.  How should it be created
> > in order to be managed?
> >
> > On Wed, Jan 3, 2024, 3:59 AM Claus Ibsen  wrote:
> >
> > > Hi
> > >
> > > You should not overwrite start and stop methods. But implement doStart
> /
> > > doStop if you need any logic.
> > >
> > > And how do you create DynamicRouterControlService in the first place
> > >
> > > On Tue, Jan 2, 2024 at 11:40 PM Steve973  wrote:
> > >
> > > > Hi, all.  I was talking about this on the users list, but I found out
> > > about
> > > > the dev list, so I wanted to share this question with fellow camel
> > > > devs/contributors.
> > > >
> > > > I am adding JMX reporting and control to my dynamic router eip
> > component
> > > > (not the original dynamic router that you can use with the DSL in
> > > core).  I
> > > > have two services that I annotated with camel-management annotations:
> > > >
> > > > For JMX control (things removed for brevity):
> > > >
> > > > @Converter(generateBulkLoader = true)
> > > > @ManagedResource(description = "Dynamic Router control operations
> > > service")
> > > > public class DynamicRouterControlService extends ServiceSupport {
> > > >
> > > > private final CamelContext camelContext;
> > > >
> > > > private final DynamicRouterFilterService filterService;
> > > >
> > > > public DynamicRouterControlService(CamelContext camelContext,
> > > >DynamicRouterFilterService
> > > > filterService) {
> > > > this.camelContext = camelContext;
> > > > this.filterService = filterService;
> > > > }
> > > >
> > > > @ManagedOperation(description = "Subscribe for dynamic routing
> > > > with a predicate expression")
> > > > public String subscribeWithPredicateExpression(
> > > > String subscribeChannel,
> > > > String subscriptionId,
> > > > String destinationUri,
> > > > int priority,
> > > > String predicate,
> > > > String expressionLanguage,
> > > > boolean update) {
> > > > return filterService.addFilterForChannel(subscriptionId,
> > > priority,
> > > > obtainPredicateFromExpression(camelContext,
> predicate,
> > > > expressionLanguage),
> > > > destinationUri, subscribeChannel, update);
> > > > }
> > > >
> > > > @ManagedOperation(description = "Subscribe for dynamic routing
> > > > with the name of a predicate bean in the registry")
> > > > public String subscribeWithPredicateBean(
> > > > String subscribeChannel,
> > > > String subscriptionId,
> > > > String destinationUri,
> > > > int priority,
> > > > String predicateBean,
> > > > boolean update) {
> > > > return filterService.addFilterForChannel(subscriptionId,
> > > priority,
> > > > obtainPredicateFromBeanName(predicateBean,
> > camelContext),
> > > > destinationUri, subscribeChannel, update);
> > > > }
> > > >
> > > > @ManagedOperation(desc

Re: Adding JMX reporting and control to dynamic router eip component

2024-01-03 Thread Steve973
An instance is created in the control producer.  How should it be created
in order to be managed?

On Wed, Jan 3, 2024, 3:59 AM Claus Ibsen  wrote:

> Hi
>
> You should not overwrite start and stop methods. But implement doStart /
> doStop if you need any logic.
>
> And how do you create DynamicRouterControlService in the first place
>
> On Tue, Jan 2, 2024 at 11:40 PM Steve973  wrote:
>
> > Hi, all.  I was talking about this on the users list, but I found out
> about
> > the dev list, so I wanted to share this question with fellow camel
> > devs/contributors.
> >
> > I am adding JMX reporting and control to my dynamic router eip component
> > (not the original dynamic router that you can use with the DSL in
> core).  I
> > have two services that I annotated with camel-management annotations:
> >
> > For JMX control (things removed for brevity):
> >
> > @Converter(generateBulkLoader = true)
> > @ManagedResource(description = "Dynamic Router control operations
> service")
> > public class DynamicRouterControlService extends ServiceSupport {
> >
> > private final CamelContext camelContext;
> >
> > private final DynamicRouterFilterService filterService;
> >
> > public DynamicRouterControlService(CamelContext camelContext,
> >DynamicRouterFilterService
> > filterService) {
> > this.camelContext = camelContext;
> > this.filterService = filterService;
> > }
> >
> > @ManagedOperation(description = "Subscribe for dynamic routing
> > with a predicate expression")
> > public String subscribeWithPredicateExpression(
> > String subscribeChannel,
> > String subscriptionId,
> > String destinationUri,
> > int priority,
> > String predicate,
> > String expressionLanguage,
> > boolean update) {
> > return filterService.addFilterForChannel(subscriptionId,
> priority,
> > obtainPredicateFromExpression(camelContext, predicate,
> > expressionLanguage),
> > destinationUri, subscribeChannel, update);
> > }
> >
> > @ManagedOperation(description = "Subscribe for dynamic routing
> > with the name of a predicate bean in the registry")
> > public String subscribeWithPredicateBean(
> > String subscribeChannel,
> > String subscriptionId,
> > String destinationUri,
> > int priority,
> > String predicateBean,
> > boolean update) {
> > return filterService.addFilterForChannel(subscriptionId,
> priority,
> > obtainPredicateFromBeanName(predicateBean, camelContext),
> > destinationUri, subscribeChannel, update);
> > }
> >
> > @ManagedOperation(description = "Subscribe for dynamic routing
> > with a predicate instance")
> > public String subscribeWithPredicateInstance(
> > String subscribeChannel,
> > String subscriptionId,
> > String destinationUri,
> > int priority,
> > Object predicate,
> > boolean update) {
> > return filterService.addFilterForChannel(subscriptionId,
> > priority, obtainPredicateFromInstance(predicate),
> > destinationUri, subscribeChannel, update);
> > }
> >
> > @ManagedOperation(description = "Unsubscribe for dynamic routing
> > on a channel by subscription ID")
> > public boolean removeSubscription(
> > String subscribeChannel,
> > String subscriptionId) {
> > return filterService.removeFilterById(subscriptionId,
> > subscribeChannel);
> > }
> >
> > @Override
> > public void start() {
> > // no-op
> > }
> >
> > @Override
> > public void stop() {
> > // no-op
> > }
> > }
> >
> > For reporting/monitoring (things removed for brevity):
> >
> > @ManagedResource(description = "Dynamic Router filter service")
> > public class DynamicRouterFilterService extends ServiceSupport {
> >
> > private final Map > ConcurrentSkipListSet> filterMap = new
> > ConcurrentHashMap<>();
> >
> > private final Map>
> > filterStatisticsMap = new ConcurrentHashMap<>();
> >
> > private final Supplier
>

Adding JMX reporting and control to dynamic router eip component

2024-01-02 Thread Steve973
Hi, all.  I was talking about this on the users list, but I found out about
the dev list, so I wanted to share this question with fellow camel
devs/contributors.

I am adding JMX reporting and control to my dynamic router eip component
(not the original dynamic router that you can use with the DSL in core).  I
have two services that I annotated with camel-management annotations:

For JMX control (things removed for brevity):

@Converter(generateBulkLoader = true)
@ManagedResource(description = "Dynamic Router control operations service")
public class DynamicRouterControlService extends ServiceSupport {

private final CamelContext camelContext;

private final DynamicRouterFilterService filterService;

public DynamicRouterControlService(CamelContext camelContext,
   DynamicRouterFilterService
filterService) {
this.camelContext = camelContext;
this.filterService = filterService;
}

@ManagedOperation(description = "Subscribe for dynamic routing
with a predicate expression")
public String subscribeWithPredicateExpression(
String subscribeChannel,
String subscriptionId,
String destinationUri,
int priority,
String predicate,
String expressionLanguage,
boolean update) {
return filterService.addFilterForChannel(subscriptionId, priority,
obtainPredicateFromExpression(camelContext, predicate,
expressionLanguage),
destinationUri, subscribeChannel, update);
}

@ManagedOperation(description = "Subscribe for dynamic routing
with the name of a predicate bean in the registry")
public String subscribeWithPredicateBean(
String subscribeChannel,
String subscriptionId,
String destinationUri,
int priority,
String predicateBean,
boolean update) {
return filterService.addFilterForChannel(subscriptionId, priority,
obtainPredicateFromBeanName(predicateBean, camelContext),
destinationUri, subscribeChannel, update);
}

@ManagedOperation(description = "Subscribe for dynamic routing
with a predicate instance")
public String subscribeWithPredicateInstance(
String subscribeChannel,
String subscriptionId,
String destinationUri,
int priority,
Object predicate,
boolean update) {
return filterService.addFilterForChannel(subscriptionId,
priority, obtainPredicateFromInstance(predicate),
destinationUri, subscribeChannel, update);
}

@ManagedOperation(description = "Unsubscribe for dynamic routing
on a channel by subscription ID")
public boolean removeSubscription(
String subscribeChannel,
String subscriptionId) {
return filterService.removeFilterById(subscriptionId, subscribeChannel);
}

@Override
public void start() {
// no-op
}

@Override
public void stop() {
// no-op
}
}

For reporting/monitoring (things removed for brevity):

@ManagedResource(description = "Dynamic Router filter service")
public class DynamicRouterFilterService extends ServiceSupport {

private final Map> filterMap = new
ConcurrentHashMap<>();

private final Map>
filterStatisticsMap = new ConcurrentHashMap<>();

private final Supplier filterFactorySupplier;

public DynamicRouterFilterService(final
Supplier filterFactorySupplier) {
this.filterFactorySupplier = filterFactorySupplier;
LOG.debug("Created Dynamic Router component");
}

@ManagedAttribute(description = "Get the list of filters for the
specified dynamic router channel")
public Collection getFiltersForChannel(final
String channel) {
return List.copyOf(filterMap.get(channel));
}

@ManagedAttribute(description = "Get the map of filters for all
dynamic router channels")
public Map>
getFilterMap() {
return Map.copyOf(filterMap);
}

@ManagedAttribute(description = "Get the set of filter statistics
for the specified dynamic router channel")
public List
getStatisticsForChannel(final String channel) {
return List.copyOf(filterStatisticsMap.get(channel));
}

@ManagedAttribute(description = "Get the map of statistics for all
dynamic router channels")
public Map>
getFilterStatisticsMap() {
return Map.copyOf(filterStatisticsMap);
}

@Override
public void start() {
// no-op
}

@Override
public void stop() {
// no-op
}
}

I want to write a test that verifies that camel is registering these.  I
have added camel-management to my pom in the "test" scope.  I originally
tried to use a test annotated with @CamelSpringTest, but I could not it to
work, and when I tried to get the ManagementAgent, it was always null.  So
I switched to a normal test that extends 

Re: Upgrade to CXF 3.1.x

2015-07-09 Thread Steve973
Sorry, I thought I was only responding to one person.

On Thu, Jul 9, 2015 at 10:30 AM, Steve973 steve...@gmail.com wrote:

 Hello.  I guess it is quite unlikely, but I know someone named Satoshi
 Yoshida from Japan.  He was in the USA as an exchange student for college.
 But I have not heard from him since the earthquake.  Do you happen to know
 him?

 Thanks,
 Steve

 On Thu, Jul 9, 2015 at 9:35 AM, Aki Yoshida elak...@gmail.com wrote:

 I can look into it tomorrow unless someone is already working on it or
 planning to do so.
 let me know.
 regards, aki

 2015-07-09 8:03 GMT+02:00 Claus Ibsen claus.ib...@gmail.com:
  Hi
 
  Wonder if any of the CXF guys can upgrade Camel master branch to the
  new 3.1.x versions of Apache CXF.
 
  There may be more than just to do a version change in a pom.xml
  https://issues.apache.org/jira/browse/CAMEL-8893
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  Email: cib...@redhat.com
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
  hawtio: http://hawt.io/
  fabric8: http://fabric8.io/





Re: Upgrade to CXF 3.1.x

2015-07-09 Thread Steve973
Hello.  I guess it is quite unlikely, but I know someone named Satoshi
Yoshida from Japan.  He was in the USA as an exchange student for college.
But I have not heard from him since the earthquake.  Do you happen to know
him?

Thanks,
Steve

On Thu, Jul 9, 2015 at 9:35 AM, Aki Yoshida elak...@gmail.com wrote:

 I can look into it tomorrow unless someone is already working on it or
 planning to do so.
 let me know.
 regards, aki

 2015-07-09 8:03 GMT+02:00 Claus Ibsen claus.ib...@gmail.com:
  Hi
 
  Wonder if any of the CXF guys can upgrade Camel master branch to the
  new 3.1.x versions of Apache CXF.
 
  There may be more than just to do a version change in a pom.xml
  https://issues.apache.org/jira/browse/CAMEL-8893
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  Email: cib...@redhat.com
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
  hawtio: http://hawt.io/
  fabric8: http://fabric8.io/



Re: [HEADS UP] - Compiling components now include validation of you included documentation

2015-06-19 Thread Steve973
Claus,

That is an excellent requirement.  Bravo!

On Fri, Jun 19, 2015 at 10:30 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 I am putting some final touches on a maven goal that is enabled by
 default as part of building the Camel source code / components. The
 goal validates that you have been a good person and include
 documentation for all the component and endpoint options, include some
 description what the component does, and added a label to categorize
 the component, and so on.

 This is possible because every component now includes full out of the
 box documentation for all their options (only salesforce is pending).

 The aim is to ensure we document all the options in the future and
 that the docs stay up to date. We have frankly to many components that
 get out of sync with the wiki pages.

 Bonus goals is that we will be able to generate parts of the component
 documentation in the future to keep it automatic up to date, and much
 more.

 But I just wanted to bring attention to this new validation goal. If
 you omit some documentation etc the goal reports what the error is,
 and which options you need to document.

 And for documentation, its just javadoc on the setter (or getter, but
 we favor the setter).


 PS: I will push the code changes later when I have run a full build of
 the code to ensure they all pass the validation.


 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8: http://fabric8.io/



Re: Edit to xmljson wiki

2015-02-12 Thread Steve973
Thanks, Claus.  I'm sure it will save a few people some headaches.

On Thu, Feb 12, 2015 at 1:22 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Thanks for reporting. I added a note to the end of that documentation.

 On Tue, Feb 10, 2015 at 6:28 PM, Steve973 steve...@gmail.com wrote:
  All,
 
  I noticed that the dependencies section (at the bottom of the wiki page)
  needs to mention the issue with xom:
 
  !-- NOTICE: XOM cannot be included by default due to an incompatible
  license; please review its license model and install the dependency
  manually if you agree. --
 
  and, perhaps, a dependency element for the pom:
 
  dependency
  groupIdxom/groupId
  artifactIdxom/artifactId
  version1.2.5/version
  /dependency
 
  I just signed up for this dev list today, and I can go through the
 process
  of signing the contributor license and faxing or scanning it and sending
 it
  to apache, but I wanted to mention it here so that it doesn't fall by the
  wayside, or in case anyone wants to add the info sooner than I'd be able
 to
  contribute it.
 
  Thanks,
  Steve



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8: http://fabric8.io/



Edit to xmljson wiki

2015-02-10 Thread Steve973
All,

I noticed that the dependencies section (at the bottom of the wiki page)
needs to mention the issue with xom:

!-- NOTICE: XOM cannot be included by default due to an incompatible
license; please review its license model and install the dependency
manually if you agree. --

and, perhaps, a dependency element for the pom:

dependency
groupIdxom/groupId
artifactIdxom/artifactId
version1.2.5/version
/dependency

I just signed up for this dev list today, and I can go through the process
of signing the contributor license and faxing or scanning it and sending it
to apache, but I wanted to mention it here so that it doesn't fall by the
wayside, or in case anyone wants to add the info sooner than I'd be able to
contribute it.

Thanks,
Steve