-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Disabling standard rate providers failed #170
Comments
any news here ? |
Not yet, will have a look at it asap. We should get out a maintenance release of the RI asap, so hopefully we can include this issues as well. |
To understand the loading system, investigate
I was able to achieve disabling them with this config
|
Thanks for this hint. With it, I only see the following logs: but no „… start remotely“ any more, fine ! |
I don't think you can - not easily. |
Loading of the exchange rate providers is controlled by the service loader logic. The mentioned config AFAIK only is for controlling the loading logic, so loading cannot be switched of as of now. |
With 1.2 the rate providers come in their own jars, so just avoid loding them, e.g. using Mven excludes, should work fine. |
@atsticks: Thank you for the suggestion to avoid loading unnecessary rate providers at build/assembly time using Maven/SBT. The issue I face is even if I only use I've tried updating my Is there a way to specify the exact providers I'd like start/load in the 1.3 release?
|
I implemented my own |
The way this is currently solved is confusing to me: as a user I feel like I have no control over what is happening. Like @wderose I would like to have a single provider with no historic data that loads data once a day. I could not figure out how to do that? We are using the currency conversions in user web requests, and don't know how do deal with the 20s pauses when JavaMoney downloads some files. |
At least @thweiss mentioned, he created his own, and I know, corporate users like Zalando also do, so it should work now, I don't think they build their own Moneta, just extending it. There's a conversion example in https://github.com/JavaMoney/javamoney-examples/blob/master/console/javamoney-console-java10/src/main/java/org/javamoney/examples/console/java10/convert/ConversionExample.java (also a Java 8 equivalent) but they only pick between IMF and ECB, not disable one of them or add a new provider. |
Thank for your reply. I've tried the solution provided by @fprochazka but it does not work for me. I still get the following in my log:
This is my config:
what am I doing wrong? |
I hope @fprochazka could tell you a little more e.g. where he placed the file (on the classpath I would assume) |
And feel free to create a ticket for the example because that could help others to understand how to use it. |
OK, thanks. No stress. I can create a ticket, but I'm not sure for what. I don't think there is a bug, but I just can't figure out how to configure my use case. Does anybody have the same use case as me? I cannot have JavaMoney download resources while blocking one of our client request for 20 seconds. I want it to download what it needs on startup, and then regularly in an asynchronous fashion. I only need one provider for daily data. |
Yes, e.g. @fprochazka or @dominik42, which is why I think it can't hurt to create a quick and easy example that shows how to do that. Companies like Zalando also did that earlier, so it should work but we had no time to fully document that case and it seems neither did Zalando, maybe they demonstrated it during a MeetUp, but I don't think it was documented in a publicly available space. |
Well... I've completely changed the strategy for loading exchanges rates, because loading it per-process and holding in memory became a problem for us. I was forced to introduce several hacks to disable the default loading completely, introduced an abstract database provider, that is then extended for each exchange rate type and also made our own loader, that is executed periodically, that uses the parsing logic from moneta, but once the exchange rates are parsed, it then saves them to database, where the database provider can pick it up. I was planning on introducing a propper solution for disabling the exchange rate providers and sending a PR, but never got to it, sorry. |
If you still can, we appreciate, does it require a change and custom-build of Moneta right now? I cannot outrule Zalando also does because they are a large company, but the goal (especially for a follow-up JSR) would be to just configure it. |
I'd love to send a PR that would make this easier, but I can't promise I'll have time in the near future. |
OK no worries, did it work with the mentioned file only or did you have to fork and patch parts of the RI? |
I have the same problem as @ayedo. I overrided javamoney.properties in my SpringBoot application and locally it looks nice. But, when I run it on server, javamoney/properties which is in resources folder is ignoring. I am using version 1.4.2 of javamoney. Any ideas? ;) |
Could you tell us a little more about the server, is it a JavaEE/Jakarta EE server or Spring Framework running in a container? |
It is simple SpringBoot (2.2.5) application with Tomcat inside. ;) Should I simply decrease version to 1.3.x? |
As a test or comparison why not. We are preparing 1.4.3 before eventually in the next year there could even be a new JavaMoney spec, but that'll take a little time. Thanks for the observations. |
Is there any more insight on this issue? We also have a Spring Boot app (embedded tomcat) and overriding with the |
No not that we know of, there are PRs like #347 but they are about different things. The issue was closed and so far @fprochazka did not get a chance to raise a PR for this one. |
Thanks @keilw. I actually confirmed that my spring boot What is the suggested way to adjust the rate providers that are leveraged if we want current but no historic providers? The |
In case this helps others, I'm using version 1.3 and was seemingly able to stop providers from loading using the
Additionally, I wanted to load rates at startup AND with the default schedule. I was able to throw something like below into my app startup which fetches rates. Lastly, someone above noted waiting for 20 seconds for rates. Below will help that by pushing it to startup. The root cause of that might be due to this.
|
Is there any update on this? My use case is that I want to disable loading of providers in some tests because it significantly slows down our pipelines.. at the moment it seems impossible to do, but looking at the source code it should be simple enough to do with an additional property in In Like it was mentioned in comments above, setting |
The only way you can fully disable IMF or ECB is by patching Moneta and disabling the modules you don't like in moneta/pom.xml and moneta-convert/pom.xml. |
As mentioned at Stackoverflow an issues was filed as JAVAMONEY-131 regarding disabling of the standard rate provider like ECBCurrentRateProvider, ECBHistoric90RateProvider, IMFRateProvider etc. The JIRA page mentioned above isn't available any longer, at github I can't find any regarding issue and with version 1.1 this bug still exists. Here the content of my javamoney.properties
But somehow the services are started
How can I disable all standard provider ?
The text was updated successfully, but these errors were encountered: