Skip to content

Commit

Permalink
fix(upload-notes): fixed rabbit connection
Browse files Browse the repository at this point in the history
  • Loading branch information
EchoSkorJjj committed Apr 23, 2024
1 parent 9de5215 commit db227a4
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import javax.net.ssl.SSLContext;
import java.security.SecureRandom;
import java.security.KeyStore;
import javax.net.ssl.TrustManagerFactory;

@Configuration
@EnableRabbit
Expand Down Expand Up @@ -55,11 +51,7 @@ public CachingConnectionFactory connectionFactory() {
System.out.println("SSL enabled: " + sslEnabled);
if (sslEnabled) {
try {
SSLContext sslContext = SSLContext.getInstance(env.getProperty("spring.rabbitmq.ssl.algorithm"));
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore) null);
sslContext.init(null, tmf.getTrustManagers(), new SecureRandom());
factory.getRabbitConnectionFactory().useSslProtocol(sslContext);
factory.getRabbitConnectionFactory().useSslProtocol();
} catch (Exception e) {
logger.error("Failed to set up SSL context", e);
throw new RuntimeException("Failed to set up SSL context", e);
Expand Down

0 comments on commit db227a4

Please sign in to comment.