I'm trying to read from pubsub and writing it into memorystore redis instance. I'm using jedispool as the process is multithreaded. I'm able to write the data coming from pubsub into the instance only if the messages are coming at 1/sec rate. But if I'm increasing the incoming messages rate to 100/s, I'm getting EOFExceptions.As said before the TLS is enabled for the instance and therefore had to provide the certificate while connecting.For which I wrote following piece of code:
Blob blob=storage.get("gcs-location","server-ca.jks);ReadChannel readchannel =blob.reader();FileOutputStream fileoutputStream;fileOutputStream= new FileOutputStream("/tmp/server-ca.jks");fileOutputStream.getChannel().transferFrom(readChannel, 0, Long.MAX_VALUE);fileOutputStream.close();readChannel.close();String tlsFilePath="/tmp/server-ca.jks"; System.setProperty("javax.net.ssl.truststore", tlsFilePath);ystem.setProperty("javax.net.ssl.trustStorePassword", "P@ss"); String keyStorePassword = "P@ss"; InputStream keyStoreInputStream = new FileInputStream(tlsFilePath);KeyStore keyStore = KeyStore.getInstance("JKS");keyStore.load(keyStoreInputStream, keyStorePassword. toCharArray());KeyManagerFactory keyManagerFactory KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keyStore, keyStorePassword. toCharArray());keyStoreInputStream.close();TrustManagerFactory trustManagerFactory TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());trustManagerFactory.init(keyStore);SSLContext sslContext SSLContext.getInstance("TLS");sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null);SSLSocketFactory ss1SocketFactory = sslContext.getSocketFactory();
I'm getting error at this line:keyStore.load(keyStoreInputStream, keyStorePassword. toCharArray());
The error I'm getting is as following:
java.io.EOFExceptionjava.base/java.io.DataInputStream.readint(DataInputStream.java:397)java.base/sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:662) java.base/sun.security.util.KeyStore Delegator.engineLoad(KeyStore Delegator.java:222)java.base/java.security.KeyStore.load(KeyStore.java:1479)
I want to know why I'm not getting errors at 1 message/sec rate but getting if reading data at 100 messages/sec rate. Let me know if I'm going wrong anywhere.