Sales ECB Proxy

https://github.com/UnionVMS/UVMS-SalesModule-ECBPROXY


Proxy description

This proxy provides exchange rates for the Sales module.

It uses a webservice of the European Central Bank, which is free to use.

As of version 1.0.3, the exchange rates are stored in a database instead of fetching the data during deployment.

Prior to 1.0.3, the proxy would return exactly what the European Central Bank returned:

  • If there was no exchange rate for EUR → USD on  '27/02/2018', no exchange rate would be returned

Now, the proxy returns the last known exchange rate:

  • If there was no exchange rate for EUR → USD on  '27/02/2018', but there was an exchange rate for EUR → USD on '26/02/2018', the '26/02/2018' rate will be returned.

How to install?

Maven dependency

Maven
<dependency>
    <groupId>eu.europa.ec.fisheries.uvms.sales</groupId>
    <artifactId>sales-proxy-ecb</artifactId>
    <version>LATEST</version>
</dependency>


JMS-Queue dependencies

Name

JNDI name

Description

UVMSSalesEcbProxy
java:/jms/queue/UVMSSalesEcbProxy

Request queue to the Sales ECB Proxy

UVMSSalesEcbProxyConfig
java:/jms/queue/UVMSSalesEcbProxyConfig

Queue to sync with config

Queues
<admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/jms/queue/UVMSSalesEcbProxy" use-java-context="true" pool-name="UVMSSalesEcbProxy">
   <config-property name="PhysicalName">
       UVMSSalesEcbProxy
   </config-property>
</admin-object>

<admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/jms/queue/UVMSSalesEcbProxyConfig" use-java-context="true" pool-name="UVMSSalesEcbProxyConfig">
	<config-property name="PhysicalName">
		UVMSSalesEcbProxyConfig
	</config-property>
</admin-object>


Module dependencies

Make sure the following modules have also been deployed.

NameRepository
SalesSales


Datasources

Name

JNDI name

uvms_salesecbproxy

java:/jdbc/uvms_salesecbproxy

Datasources
<datasource jta="true" jndi-name="java:/jdbc/uvms_salesecbproxy" pool-name="uvms_salesecbproxy" enabled="true" use-ccm="true">
    <connection-url>jdbc:postgresql://dbunid02/duvms?defaultSchema=salesecbproxy</connection-url>
    <driver-class>org.postgresql.Driver</driver-class>
    <driver>postgresql</driver>
    <security>
        <user-name>salesecbproxy</user-name>
        <password>salesecbproxy</password>
    </security>
</datasource>

The sales ecb proxy lets you free in choosing the schema name.
On the other side, this also means that the schema name is not included in queries, so make sure that the schema is on the user's search path.

Whitelist the url

When you use the default ECB webservice, make sure to whitelist: http://sdw-wsrest.ecb.europa.eu/service/data/EXR/D..EUR.SP00.A


Writing a similar proxy

Contract