Skip to content

Commit

Permalink
Merge remote-tracking branch
Browse files Browse the repository at this point in the history
'origin/issue/233_Misses_Task_and_QuestionnaireResponse_on_Network_Disconnect'
into develop
  • Loading branch information
hhund committed Oct 8, 2024
2 parents be96436 + 5ee060b commit ed83bac
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void connectWebsocket(Subscription subscription)
{
try
{
WebsocketClient client = clientProvider.getLocalWebsocketClient(() -> connect(),
WebsocketClient client = clientProvider.getLocalWebsocketClient(this::connect,
subscription.getIdElement().getIdPart());

EventType eventType = toEventType(subscription.getChannel().getPayload());
Expand Down Expand Up @@ -260,7 +260,7 @@ private Void onError(Throwable t)
{
// no debug log, exception previously logged by retrieveWebsocketSubscription, loadNewResources and
// connectWebsocket methods
logger.error("Error while loading existing {} resources and connecting websocket: {} - {}", resourceName,
logger.error("Error loading existing {} resources and connecting websocket: {} - {}", resourceName,
t.getClass().getName(), t.getMessage());

return null;
Expand Down
18 changes: 17 additions & 1 deletion dsf-docker-test-setup-3dic-ttp/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.8'
services:
proxy:
image: nginx:1.23
image: nginx:1.27
restart: "no"
ports:
- 127.0.0.1:443:443
Expand Down Expand Up @@ -106,6 +106,15 @@ services:
--spi-truststore-file-password=password
--spi-truststore-file-hostname-verification-policy=STRICT
forward-proxy:
build: ./forward-proxy
restart: "no"
environment:
TZ: Europe/Berlin
networks:
forward-proxy:
internet:

dic1-fhir:
build: ../dsf-fhir/dsf-fhir-server-jetty/docker
image: datasharingframework/fhir
Expand Down Expand Up @@ -518,15 +527,21 @@ services:
DEV_DSF_SERVER_AUTH_OIDC_PROVIDER_CLIENT_TRUST_SERVER_CERTIFICATE_CAS: /run/secrets/app_server_trust_certificates.pem
DEV_DSF_SERVER_AUTH_OIDC_CLIENT_ID: dic1-bpe
DEV_DSF_SERVER_AUTH_OIDC_CLIENT_SECRET: ytqFCErw9GfhVUrrM8xc0Grbu4r7qGig
DEV_DSF_PROXY_URL: http://forward-proxy:8080
DEV_DSF_PROXY_USERNAME: proxy_user
DEV_DSF_PROXY_PASSWORD: proxy_password
DEV_DSF_PROXY_NOPROXY: keycloak
networks:
dic1-bpe-frontend:
ipv4_address: 172.20.0.35
dic1-bpe-backend:
internet:
forward-proxy:
depends_on:
- db
- dic1-fhir
- keycloak
- forward-proxy

dic2-bpe:
build: ../dsf-bpe/dsf-bpe-server-jetty/docker
Expand Down Expand Up @@ -944,6 +959,7 @@ networks:
- subnet: 172.20.0.56/29
ttp-bpe-backend:
internet:
forward-proxy:

volumes:
db-data:
Expand Down
4 changes: 4 additions & 0 deletions dsf-docker-test-setup-3dic-ttp/forward-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alpine:3.20
RUN apk add --no-cache tinyproxy
COPY tinyproxy.conf /etc/tinyproxy/tinyproxy.conf
CMD ["tinyproxy", "-d"]
6 changes: 6 additions & 0 deletions dsf-docker-test-setup-3dic-ttp/forward-proxy/tinyproxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
User tinyproxy
Group tinyproxy
Port 8080
Timeout 100
LogLevel Connect
BasicAuth proxy_user proxy_password
46 changes: 0 additions & 46 deletions dsf-docker-test-setup-3dic-ttp/proxy/conf.d/default.conf

This file was deleted.

21 changes: 1 addition & 20 deletions dsf-docker-test-setup-3dic-ttp/proxy/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@

user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
Expand All @@ -19,15 +9,6 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

ssl_certificate /run/secrets/proxy_certificate_and_int_cas.pem;
ssl_certificate_key /run/secrets/proxy_certificate_private_key.pem;
ssl_protocols TLSv1.2 TLSv1.3;
Expand All @@ -45,4 +26,4 @@ http {
}

include /etc/nginx/conf.d/*.conf;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.dsf.fhir.client;

import java.util.EnumSet;
import java.util.function.Consumer;
import java.util.function.Supplier;

Expand Down Expand Up @@ -80,7 +81,8 @@ public void onClose(Session session, CloseReason closeReason)
logger.warn("Websocket closed, session {}: {} - {}", session.getId(), closeReason.getCloseCode().getCode(),
closeReason.getReasonPhrase());

if (CloseReason.CloseCodes.CANNOT_ACCEPT.equals(closeReason.getCloseCode()))
if (EnumSet.of(CloseReason.CloseCodes.CANNOT_ACCEPT, CloseReason.CloseCodes.CLOSED_ABNORMALLY)
.contains(closeReason.getCloseCode()))
{
logger.info("Trying to reconnect websocket");
reconnector.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public boolean onDisconnect(CloseReason closeReason)
private final String userAgentValue;
private final ClientEndpoint endpoint;

private ClientManager manager;
private Session connection;
private volatile ClientManager manager;
private volatile Session connection;
private volatile boolean closed;

public WebsocketClientTyrus(Runnable reconnector, URI wsUri, KeyStore trustStore, KeyStore keyStore,
Expand Down Expand Up @@ -131,6 +131,8 @@ public void connect()
if (manager != null)
throw new IllegalStateException("Allready connecting/connected");

closed = false;

manager = ClientManager.createClient();
manager.getProperties().put(ClientProperties.RECONNECT_HANDLER, reconnectHandler);
manager.getProperties().put(ClientProperties.SSL_ENGINE_CONFIGURATOR, new SslEngineConfigurator(sslContext));
Expand Down

0 comments on commit ed83bac

Please sign in to comment.