The adapter is an anti corruption layer (ACL) between the external NHN Meldingstjener API (EDI 2.0) and our internal sevices.
This provides a stable internal interface under /api/v1/* so the rest of the ecosystem remains unaffected by external API
changes.
Key Takeaways:
- Our internal consumers use
/api/v1/*only. - The adapter manages all communication and error handling with NHN.
- Authentication and certificates are configured in
ediClient. - Metrics are collected through
PrometheusMeterRegistry. - Any change to the NHN API should result in updating this adapter, not the calling services.
Simplifies sending and receiving EDI 2.0 messages. Isolates all network calls, parameters, and schema handling. If NHN changes their API, only this adapter requires modification.
All routes exposed by this adapter are under /api/v1.
| Method | Path | Description | Calls external NHN endpoint |
|---|---|---|---|
| GET | /api/v1/messages |
Fetch messages for given receiver(s) | GET /Messages |
| GET | /api/v1/messages/{messageId} |
Fetch a single message | GET /Messages/{id} |
| GET | /api/v1/messages/{messageId}/document |
Download the message payload | GET /Messages/{id}/business-document |
| GET | /api/v1/messages/{messageId}/status |
Get message status | GET /Messages/{id}/status |
| GET | /api/v1/messages/{messageId}/apprec |
Retrieve application receipt | GET /Messages/{id}/apprec |
| POST | /api/v1/messages |
Send a new message | POST /Messages |
| POST | /api/v1/messages/{messageId}/apprec/{apprecSenderHerId} |
Send application receipt | POST /Messages/{id}/apprec/{appRecSenderHerId} |
| PUT | /api/v1/messages/{messageId}/read/{herId} |
Mark message as read | PUT /Messages/{id}/read/{herId} |
Adapter's API routes are defined in externalRoutes under /api/v1.
Each route calls the corresponding NHN endpoint.
Metrics and health checks are provided through internalRoutes.
| Path | Description |
|---|---|
/internal/health/liveness |
Returns “I'm alive! :)” |
/internal/health/readiness |
Returns “I'm ready! :)” |
/prometheus |
Prometheus metrics endpoint |
The adapter wraps the NHN Meldingstjener API (EDI 2.0). Official documentation and endpoint definitions are available at:
utviklerportal.nhn.no - meldingstjener-api-test-internett
Spinning up the adapter locally is a simple task which just involves a couple of small steps:
- Login to the NAIS Console
- Localize the emottak-nhn-edi secret and copy the keypair-jwk value
- Paste the value from the previous step into the
src/test/resources/keypair-jwk.jsonfile - Run the adapter. In most IDE's this involves clicking on the
Appfile and run it
When the server is running its curlable with ie: curl http://localhost:8080/api/v1/messages/{messageId}/apprec.
The adapter is then POST'ing and GET'ing data to and from the NHN test environment in the background.
NOTE: This implies that the NHN_KEYPAIR_PATH envionment variable hasn't been set locally (this is only used by NAIS).
Hoplite defaults to the test file mentioned above as can be seen in the application.conf file.