Force local akka serialization - serialization

I have some doubts regarding akka remote and serialization (what I can and can't do) and for this reason I want to force akka to use remote in the local actor systems.
How can I acheive that?

You can turn on serialization for all messages (remote and local):
akka {
actor {
serialize-messages = on
}
}

Related

SSL Enabled Storm Kafka Spout

I wated to know is there any Kafka Spout which supports Secure Kafka Brokers.
KafkaSpout from apache storm is not having any support for SSL Kafka.
public KafkaSpout(SpoutConfig spoutConf) {
_spoutConfig = spoutConf;
}
Below mentioned Kafka not taking in any parameters for SSL Kafka producer/consumer support.
public KafkaConfig(BrokerHosts hosts, String topic) {
this(hosts, topic, kafka.api.OffsetRequest.DefaultClientId());
}
public KafkaConfig(BrokerHosts hosts, String topic, String clientId) {
this.hosts = hosts;
this.topic = topic;
this.clientId = clientId;
}
Please let me know is there any way we can achive the secure Kafka Message Stream Processing with storm topology.
Storm's old kafka-spout uses simple consumer API for which security is not supported. If you are looking to use SSL with kafka consumer you should be using
https://github.com/apache/storm/tree/master/external/storm-kafka-client
Here are the details
https://github.com/apache/storm/blob/master/docs/storm-kafka-client.md
To enable SSL its similar to what you would do regular kafka-consumer, you can follow the details in here
http://kafka.apache.org/documentation.html#security_ssl

How to modify spring-websocket to interface with broker via MQTT instead of STOMP?

I'm building a spring-websocket application that currently uses RabbitMQ as a message broker via the STOMP protocol. The rest of our organization mostly uses IBM Websphere MQ as a message broker, so we'd like to convert it away from RabbitMQ. However Websphere MQ doesn't support the STOMP protocol, which is spring-websocket's default. MQTT seems like the easiest supported protocol to use instead. Ideally our front-end web clients will continue to use STOMP, but I'm also OK with migrating them to MQTT if needed.
What classes do I need to overwrite to make spring-websocket interface with the broker via MQTT instead of STOMP? This article provides some general guidance that I should extend AbstractMessageBrokerConfiguration, but I'm unclear where to begin.
Currently I'm using the standard configuration methods: registry.enableStompBrokerRelay and registerStompEndpoints in AbstractWebSocketMessageBrokerConfigurer
Ryan has some good pointers.
The main work is going to be creating a replacement for StompBrokerRelayMessageHandler with an MqttBrokerMessageHandler that not only talks to an MQTT broker but also adapts client STOMP frames to MQTT and vice versa. The protocols are similar enough that it may be possible to find common ground but you won't know until you try.
Note that we did have plans for for MQTT support https://jira.spring.io/browse/SPR-12581 but the key issue was that SockJS which is required over the Web for fallback support does not support binary messages.
Here's my stab at this after reviewing the spring-websocket source code:
Change WebSocketConfig:
Remove #EnableWebSocketMessageBroker
Add new annotation: #EnableMqttWebSocketMessageBroker
Create MqttBrokerMessageHandler that extends AbstractBrokerMessageHandler -- suggest we copy and edit StompBrokerRelayMessageHandler
Create a new class that EnableMqttWebSocketMessageBroker imports: DelegatingMqttWebSocketMessageBrokerConfiguration
DelegatingMqttWebSocketMessageBrokerConfiguration extends AbstractMessageBrokerConfiguration directly and routes to MqttBrokerMessageHandler
Add this to server.xml on WebSphere Liberty:
<feature>websocket-1.1</feature>

Can I let spring-session used a standalone redis?

I have built up a redis server, I want to know whether I can make spring-session use the existed redis server instead of embed its redis-server?
Yes Spring Session can and should use an existing Redis Server. This is the primary way to deploy to production. I have provided a few examples below:
Spring Boot
Taking the Spring Boot Sample and converting it to use an external Redis Server can be done by:
Removing the #EmbeddedRedisServer annotation
Configuring the Redis Server Location For example, you might provide the following properties in your application.properties:
spring.redis.host=example.com
spring.redis.password=secret
spring.redis.port=6379
Other Samples
The other samples are quite similar to use an external Redis instance. For example, to change the httpsession sample to use an external Redis:
Remove #EnableEmbeddedRedis
Update your RedisConnectionFactory Bean definition to point to your Redis server
For example:
#Bean
public JedisConnectionFactory connectionFactory() {
JedisConnectionFactory connection = new JedisConnectionFactory();
connection.setPort(6379);
connection.setHostName("example.com");
connection.setPassword("secret");
return connection;
}

performance about apache activemq using ssl

By default, the activemq uses tcp protocol. But now, I change it to use ssl.
If I deploy the publisher and server on one machine, it makes no difference with regard to the speed. But after I deploy them on different machine, it's much slower to use ssl than to use tcp. Is this normal? If not, what's probably wrong with my code?
Thanks.
Depends on how much slower your application is working.
If you process huge amount of data volumes, SSL will take a decent amount of CPU cycles to encrypt (and also decrypt) the data. Is it the ActiveMQ server that is slower or is it the client. Profile the system setup to get an overview where to find the bottenecks.
Another possibillity is frequent hand shakes. Say your client code (can you post it?) to send messages by opening a connection for each message, it might be the case that the latency for sending a message will suffer from the increased SSL handshake time compared to plain tcp.
UPDATE:
A speed up would be to reuse your connection. A SSL handshake has to be done for every message sent in your case which involves cpu expensive asymmetric crypto and a few more tcp roundtrips than plain TCP. It is easy to do, with the pooling connection factory provided by activemq. This example does not alter your code much:
public class MySender{
private static ConnectionFactory factory = new org.apache.activemq.pool.PooledConnectionFactory("ssl://192.168.0.111:61616");
public void send(){
Connection connection = factory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic(newDataEvent.getDataType().getType());
MessageProducer producer = session.createProducer(topic);
TextMessage message = session.createTextMessage();
message.setText(xstream.toXML(newDataEvent));
producer.send(message);
session.close();
connection.close();
}
}

How can Jedis connect to a redis server using a socket connection?

I'm having problems figuring out how to use the Jedis library to connect to a redis socket connection.
I know how to connect through a network port:
Jedis jedis = new Jedis("localhost");
//Jedis jedis = new Jedis(unix_socket_path="/tmp/redis.sock");
But the socket connection(second in the list) doesn't work. The commands looked simlair to redis-py(python client) but when I tried the same syntax it didn't work. I also looked through the jedis sourcecode on github but couldn't see anything. Any ideas?
I don't think Jedis support unix domain sockets.
The constructor with a single parameter only accepts a hostname (using default TCP port).
Java is portable. It is supposed to provide the same API on different platforms. Unix domain sockets are specific to Unix/Linux. So the Java standard API does not support unix domain sockets. There are separate Java packages for this, but AFAIK, Jedis do not use them.