Making RemoteConnectionFactory available in subsystem

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Making RemoteConnectionFactory available in subsystem

Dejan Kitic
Hi guys,

I am trying to figure out if it's possible to make HornetQ RemoteConnectionFactory available within subsystem using something like:

 final CastingInjector<ConnectionFactory> connFactInjector = new CastingInjector<ConnectionFactory>(connFactInjector,

                ConnectionFactory.class);

and then doing something like:


...

.addDependency(ConnectionFactoryService.SERVICE_NAMEconnFactInjector)



within SubsystemAdd performRuntime.

Above is just thinking on the subject, the actual problem would be what to put in the addDependency call for service name, and even how to specify that I need to wait for the RemoteConnectionFactory to become available.

Might be completely off with this, so any help is appreciated.

Regards,
Dejan

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Making RemoteConnectionFactory available in subsystem

Jeff Mesnil

On 17 Jun 2014, at 13:27, Dejan Kitic <[hidden email]> wrote:

> Hi guys,
>
> I am trying to figure out if it's possible to make HornetQ RemoteConnectionFactory available within subsystem using something like:
>
>  final CastingInjector<ConnectionFactory> connFactInjector = new CastingInjector<ConnectionFactory>(connFactInjector,
>                 ConnectionFactory.class);
> and then doing something like:
>
> ...
> .addDependency(ConnectionFactoryService.SERVICE_NAME, connFactInjector)
>
>
> within SubsystemAdd performRuntime.
>
> Above is just thinking on the subject, the actual problem would be what to put in the addDependency call for service name, and even how to specify that I need to wait for the RemoteConnectionFactory to become available.

Unfortunately, that will not work.

You could create a dependency on the connection factory name but the service does not return the JMS ConnectionFactory as its value (long story short, HornetQ creates the object internally and does not expose it from its management API).
An alternative would be to depend on the JNDI binding of the remote connection factory instead.

jeff


--
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Making RemoteConnectionFactory available in subsystem

Dejan Kitic
Hi Jeff,

Big thanks for your answer. Alternative with JNDI binding sounds good - think that might just do the trick for me here.

Dejan


On Tue, Jun 17, 2014 at 2:16 PM, Jeff Mesnil <[hidden email]> wrote:

On 17 Jun 2014, at 13:27, Dejan Kitic <[hidden email]> wrote:

> Hi guys,
>
> I am trying to figure out if it's possible to make HornetQ RemoteConnectionFactory available within subsystem using something like:
>
>  final CastingInjector<ConnectionFactory> connFactInjector = new CastingInjector<ConnectionFactory>(connFactInjector,
>                 ConnectionFactory.class);
> and then doing something like:
>
> ...
> .addDependency(ConnectionFactoryService.SERVICE_NAME, connFactInjector)
>
>
> within SubsystemAdd performRuntime.
>
> Above is just thinking on the subject, the actual problem would be what to put in the addDependency call for service name, and even how to specify that I need to wait for the RemoteConnectionFactory to become available.

Unfortunately, that will not work.

You could create a dependency on the connection factory name but the service does not return the JMS ConnectionFactory as its value (long story short, HornetQ creates the object internally and does not expose it from its management API).
An alternative would be to depend on the JNDI binding of the remote connection factory instead.

jeff


--
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/



_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Making RemoteConnectionFactory available in subsystem

Tomaž Cerar-2
In reply to this post by Jeff Mesnil
Jeff,
this is not about mgmt api exposure if I understood question correctly.
It is question on level of msc services.
Code inside services cannot access JNDI at all, so injecting service as dependency is only solution.

--
tomaz


On Tue, Jun 17, 2014 at 3:16 PM, Jeff Mesnil <[hidden email]> wrote:

On 17 Jun 2014, at 13:27, Dejan Kitic <[hidden email]> wrote:

> Hi guys,
>
> I am trying to figure out if it's possible to make HornetQ RemoteConnectionFactory available within subsystem using something like:
>
>  final CastingInjector<ConnectionFactory> connFactInjector = new CastingInjector<ConnectionFactory>(connFactInjector,
>                 ConnectionFactory.class);
> and then doing something like:
>
> ...
> .addDependency(ConnectionFactoryService.SERVICE_NAME, connFactInjector)
>
>
> within SubsystemAdd performRuntime.
>
> Above is just thinking on the subject, the actual problem would be what to put in the addDependency call for service name, and even how to specify that I need to wait for the RemoteConnectionFactory to become available.

Unfortunately, that will not work.

You could create a dependency on the connection factory name but the service does not return the JMS ConnectionFactory as its value (long story short, HornetQ creates the object internally and does not expose it from its management API).
An alternative would be to depend on the JNDI binding of the remote connection factory instead.

jeff


--
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Making RemoteConnectionFactory available in subsystem

Jeff Mesnil

On 17 Jun 2014, at 15:46, Tomaž Cerar <[hidden email]> wrote:

> Jeff,
> this is not about mgmt api exposure if I understood question correctly.
> It is question on level of msc services.
> Code inside services cannot access JNDI at all, so injecting service as dependency is only solution.

I may not have been clear enough.

I advised to depend on the JNDI binding as a service using the ContextNames.bindInfoFor(name).getServiceName().
As far as I can tell, this is the only way to depend on the ConnectionFactory from inside the msc services.

--
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Making RemoteConnectionFactory available in subsystem

Dejan Kitic
In reply to this post by Tomaž Cerar-2
Hi Tomaz,

You did...It is on the level of msc services, I need to prevent my subsystem from starting up until I have RemoteConnectionFactory available. I can't do the lookup from within, so my thinking was to declare dependency to something in the messaging subsystem and use injectors to make it available to my code.
I thought there was a way to do what Jeff proposed from within the msc service.

Dejan


On Tue, Jun 17, 2014 at 2:46 PM, Tomaž Cerar <[hidden email]> wrote:
Jeff,
this is not about mgmt api exposure if I understood question correctly.
It is question on level of msc services.
Code inside services cannot access JNDI at all, so injecting service as dependency is only solution.

--
tomaz


On Tue, Jun 17, 2014 at 3:16 PM, Jeff Mesnil <[hidden email]> wrote:

On 17 Jun 2014, at 13:27, Dejan Kitic <[hidden email]> wrote:

> Hi guys,
>
> I am trying to figure out if it's possible to make HornetQ RemoteConnectionFactory available within subsystem using something like:
>
>  final CastingInjector<ConnectionFactory> connFactInjector = new CastingInjector<ConnectionFactory>(connFactInjector,
>                 ConnectionFactory.class);
> and then doing something like:
>
> ...
> .addDependency(ConnectionFactoryService.SERVICE_NAME, connFactInjector)
>
>
> within SubsystemAdd performRuntime.
>
> Above is just thinking on the subject, the actual problem would be what to put in the addDependency call for service name, and even how to specify that I need to wait for the RemoteConnectionFactory to become available.

Unfortunately, that will not work.

You could create a dependency on the connection factory name but the service does not return the JMS ConnectionFactory as its value (long story short, HornetQ creates the object internally and does not expose it from its management API).
An alternative would be to depend on the JNDI binding of the remote connection factory instead.

jeff


--
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev



_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev