New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JMS: XA-only ConnectionFactory created for ActiveMQ Artemis #1284
Comments
a big It's very confusing to end up with an application startup failure by just adding the sleuth dependency with an error message regarding unsatisfied bean dependency.
but in the config you declare a bean of the correct type:
|
Should be fixed via 1b493e6 . Please check out the latest snapshots. |
I tested this with the latest 2.2.0.BUILD-SNAPSHOT, but still have the same issue. I also don't really see from the code change how this would be fixed. A bean that is both a javax.jms.ConnectionFactory and javax.jms.XAConnectionFactory will still be wrapped in a LazyXAConnectionFactory which is not a javax.jms.ConnectionFactory anymore.
You did fix 1324, but only if the bean isn't also an XAConnectionFactory. Else the error will remain for the same reason. |
Ah true, thanks for pointing it out |
When using Sleuth for an application using AWS SQS messaging, I am getting an error, given below:
Does this mean that as per the commit here, the library need to support AWS SQSConnectionFactory ? Any pointers if I am missing something here ? |
Please learn how to properly format the code. Can you also provide which version of Sleuth you're using? |
My bad, I was trying to insert it properly using the '<>' control but seems like I made a mistake there. (I will try to rectify that.)Currently I am facing this issue with Sleuth version '2.1.0.RELEASE' |
It's not the latest GA version of Sleuth available. Please upgrade to the latest and see if the problem persists. |
The Maven repository has dependency defined for '2.1.2.RELEASE' while the latest version of this library is '2.2.0'. Do you think it will work for '2.1.2.RELEASE' ? |
Please test |
Apologies if I deviated from the process. |
UPDATE: With version '2.1.2.RELEASE' I continue to get the same error. |
Can you provide a complete, minimal, verifiable sample that reproduces the problem rather than pasted code? It should be available as a GitHub (or similar) project or attached to this issue as a zip file. |
Providing a sample would be difficult, but is there anything or any information that you are specifically looking for, that I can provide. |
I managed to create a sample spring boot application throwing the same error as I am encountering in my project. Along with it, I am also attaching the stacktrace of the exception that I am getting. Let me know if this helps. |
@marcingrzejszczak , do you think the issue I reported is a valid one or there is something wrong at my end. If possible, can you please share the proposed plan on this issue if it's a valid one ? |
I'm sorry but I didn't have time to look into it but by the looks of it some code in your codebase is requiring a direct |
Can you help me in understanding how this wrapping works and what are you suggesting me to do ? |
tracing wrappers will reduce something like SQSxxx to ConnectionFactory.
Usually in Spring you will want to auto wire the more generic type that
your code needs. typically it doesnt need the implementation type. I think
more questions about this need to move to the gitter channel
…On Wed, Jul 3, 2019, 8:26 PM Nishant ***@***.***> wrote:
Can you help me in understanding how this wrapping works and what are you
suggesting me to do ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1284?email_source=notifications&email_token=AAAPVV5T7DZ25TQ4ZEDCA33P5SLGPA5CNFSM4HA2M2TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZEIZ5I#issuecomment-508071157>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAPVV46WU5ZKLPAR7LRAV3P5SLGPANCNFSM4HA2M2TA>
.
|
@marcingrzejszczak / @adriancole , I gave a few attempts along the lines of your suggestions of using an interface to inject SQSConnectionFactory instead of a concrete implementation, but it seems like I am not getting the idea of how to do it. If possible, can give an example on how to achieve this based on the sample project that I provided. |
Apologies for delayed response. EARLIER:
LATER:
Please let me know if this is right or I should have tried something else. |
Exactly, that's what we suggested! Thanks for typing it down in the answer. We really appreciate it! |
yep this is exactly right. and any use of the concrete SQS type would not
be traced. For example, if you affected the SQS factory before returning it
as a bean, any of that is ok, but it would not be traced.
…On Thu, Jul 18, 2019 at 9:01 PM Nishant ***@***.***> wrote:
Apologies for delayed response.
I was able to solve the issue following the inputs given by
@marcingrzejszczak <https://github.com/marcingrzejszczak> & @adriancole
<https://github.com/adriancole> .
Instead of having a concrete return type of the method as
'SQSConnectionFactory', even though I continued to return an instance of
'SQSConnectionFactory' I changed the method signature to return
'ConnectionFactory'.
*EARLIER*:
public SQSConnectionFactory defaultConnectionFactory() {
return new SQSConnectionFactory(new ProviderConfiguration(), AmazonSQSClientBuilder.standard().withRegion(Regions.fromName(awsRegion))
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey))));
}
*LATER*:
public ConnectionFactory defaultConnectionFactory() {
return new SQSConnectionFactory(new ProviderConfiguration(), AmazonSQSClientBuilder.standard().withRegion(Regions.fromName(awsRegion))
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey))));
}
Please let me know if this is right or I should have tried something else.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1284?email_source=notifications&email_token=AAAPVV7JO45XVM4HIBEYAUTQABLSDA5CNFSM4HA2M2TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2IIBHA#issuecomment-512786588>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAPVV67RNVN3VMKSNKEZMLQABLSDANCNFSM4HA2M2TA>
.
|
When using ActiveMQ Artemis through JMS over remote JNDI, the connection factory we get back is an instance of org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory. But as per https://activemq.apache.org/artemis/docs/javadocs/javadoc-2.6.0/org/apache/activemq/artemis/jms/client/ActiveMQJMSConnectionFactory.html, you see this implements both javax.jms.ConnectionFactory and javax.jms.XAConnectionFactory. We want to use it in a non-XA fashion (we don't need XA transactions in our use case), but because of this check we get a XA-only ConnectionFactory back after instrumentation with Brave.
IMHO this PostProcessor should be extended to create a bean that is also both an XA and non-XA connection factory if the instrumented bean is also both. If you agree this is a bug I'm open to fixing this myself with a PR - just let me know.
The text was updated successfully, but these errors were encountered: