[ https://issues.apache.org/jira/browse/ARTEMIS-4716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17835809#comment-17835809 ]
Daniel Martin edited comment on ARTEMIS-4716 at 4/10/24 4:17 PM: ----------------------------------------------------------------- My point is rather that I don't know what to do, since I couldn't find any good example nor explanation; I was hoping to be pointed to one. Based entirely on hopeless guessing, I tried the following, among other things: {code:java} @Inject private ConnectionFactory connectionFactory; {code} For which I get: {code:java} WELD-001408: Unsatisfied dependencies for type ConnectionFactory with qualifiers @Default{code} Similarly, I get one step further when trying to inject a "context" (I haven't worked with this concept before): {code:java} @Inject private JMSContext jmsContext;{code} But when I call any method on it, say {{{}getMetadata(){}}}, I get: {code:java} javax.naming.NameNotFoundException: java:comp/DefaultJMSConnectionFactory{code} was (Author: JIRAUSER290941): My point is rather that I don't know what to do, since I couldn't find any good example nor explanation; I was hoping to be pointed to one. Based entirely on hopeless guessing, I tried the following, among other things: {code:java} @Inject private ConnectionFactory connectionFactory; {code} For which I get: {code:java} WELD-001408: Unsatisfied dependencies for type ConnectionFactory with qualifiers @Default{code} Similarly, I get one step further when trying to inject a "context" (I haven't worked with this concept before): {code:java} @Inject private JMSContext jmsContext;{code} But when I call any method on it, say {{{}getMetadata(){}}}, I get: {code:java} javax.naming.NameNotFoundException: java:comp/DefaultJMSConnectionFactory{code} > Improve Jakarta Messaging / JMS documentation > --------------------------------------------- > > Key: ARTEMIS-4716 > URL: https://issues.apache.org/jira/browse/ARTEMIS-4716 > Project: ActiveMQ Artemis > Issue Type: Improvement > Components: JMS > Affects Versions: 2.33.0 > Reporter: Daniel Martin > Priority: Minor > > I'm struggling to understand [these > instructions|https://activemq.apache.org/components/artemis/documentation/latest/using-jms.html] > to use Artemis in the context of Jakarta Messaging which perhaps could be > updated / simplified / improved. > At the moment, I'm depending on {{artemis-jakarta-client}} and manually > instantiating {{ActiveMQConnectionFactory}}. While investigating a memory > leak that may come from my usage of ActiveMQ, I wanted to simplify this part > and rely on dependency injection instead. However, I don't begin to > understand how to do such thing. > My expectation was to be able to use the {{@Inject}} annotation to get a > reference to a {{ConnectionFactory}}, {{JMSContext}}, or similar and to be > able to provide configuration such as broker address and credentials > _somewhere_ as to end up with a reference to a {{Connection}} which is > ultimately what I need. Is this possible? What's the recommended way? Is > there any (working) reference examples? -- This message was sent by Atlassian Jira (v8.20.10#820010)