[akka-user] [akka-streams] Trying to mimic socket level programming , connect client and then send data if connection is available

2016-07-31 Thread murtuza chhil
Hello,

I am a newbie trying to understand Akka Streams.

Coming from regular socket programming I am trying to mimic a client 
connection and have the following runnable graph.

Flow flow 
= Tcp
.get(system).outgoingConnection("127.0.0.1", 6000);
Source clientSource = Source.single(ByteString
.fromString("XYZ"));

clientSource.via(flow).to(Sink.ignore()).run(mat);

​

This works fine when used with the samples in the doc, where the source is 
attached that has a list and there is a server listening and we run the 
source->flow->sink through a materializer.

But this is not a typical use case, typically one would attempt to connect 
to a server,  and either it connects or fails. If connected send data that 
will be made available and if connection fails, have the ability to backoff.


Currently I don't know how to access the error when a server is not 
available and want to establish a connection before data is available.
Don't know how to prevent connections every time data is sent, I understand 
why it happens, but don't know how to reuse a materialized flow that has 
already connected.
What I am trying to get my head around is how does one run a graph without 
any source data and get a completable future that tells me if it succeeded 
or not.
Then I want to use the same connection to send data later using the source.

I have attempted with a runfold and that give me the akka TCP Exception 
when the server is not availble, but I simply want to forward the data from 
the source without manipulation.

There was another thread that I had 
started https://groups.google.com/d/msg/akka-user/1ztizMy9FnI/U9toR-cOBgAJ, 
would appreciate if someone responds to it. 

Any pointers or snippets would be greatly appreciated. Yes I am not used to 
this paradigm of programming but trying to figure it out.

-chhil

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Adaptive load balancing router in Actor subscriber

2016-07-31 Thread Lap Ming Lee
Suppose I use an *Adaptive Load Balancing Router* in an actor subscriber as 
partially demonstrated in the akka stream documentation, is this in effect 
providing back pressure for all my routee actors to ensure that they aren't 
overwhelm with messages?  And that the worker pool actor subscriber will 
apply back pressure when all the routees are near capacity? 

The workflow I have in mind is to forward all HTTP requests to this actor 
and distributed them to routees.  But I would like to drop any requests 
when my routees cannot handle anymore requests without crashing by setting 
the source's overflow strategy to drop new. 

class WorkerPool extends ActorSubscriber {
 import WorkerPool._
 import ActorSubscriberMessage._
 
 val MaxQueueSize = 10
 var queue = Map.empty[Int, ActorRef]
 
 val router = { // What if this was an Adaptive Load Balance Router instead?
   val routees = Vector.fill(3) {
 ActorRefRoutee(context.actorOf(Props[Worker]))
   }
 Router(RoundRobinRoutingLogic(), routees)
 }
 
 override val requestStrategy = new MaxInFlightRequestStrategy(max = 
MaxQueueSize) {
 override def inFlightInternally: Int = queue.size
 }
}


-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] How to disable TLSv1 when I configure "akka.remote.netty.ssl.security.protocol" property as TLSv1.2.

2016-07-31 Thread Konrad 'ktoso' Malawski
That seems like a good catch indeed!
Thanks for finding this.

I've made an issue and PR for it: 
https://github.com/akka/akka/issues/21077
https://github.com/akka/akka/pull/21078

If reviewed by team we could include this patch very soon.

Thanks for reporting!

-- Konrad

W dniu czwartek, 28 lipca 2016 09:36:59 UTC+2 użytkownik 
yinzho...@gmail.com napisał:
>
> Thank you first for your reply :)
>
> I add TLSv1 to jdk.tls.disabledAlgorithms of JRE java.security file, in 
> this way I can resolve the problem, but the modify will globally affect, 
> for example there is a java app needs TLSv1.
> Otherwise, I have tried "jdk.tls.client.protocols" system property, but it 
> does not achieve the desired effect.
>
> I have tried to invoke "setEnabledProtocols" method 
> of javax.net.ssl.SSLEngine class on my java test code, it can achieve the 
> desired effect.
> The relevant AKKA source code of akka.remoting as follow:
> case Some(context) ⇒
> log.debug("Using client SSL context to create SSLEngine ...")
> new SslHandler({
>   val sslEngine = context.createSSLEngine
>   sslEngine.setUseClientMode(true)
>   sslEngine.setEnabledCipherSuites(settings.SSLEnabledAlgorithms.
> toArray)
>   sslEngine.setEnabledProtocols(Array("TLSv1.2"))   =>  Add this 
> line can resovle my problem, but I don't want to modify AKKA source code 
> :(
>   sslEngine
>
> Is there a way to set ssl option without modify AKKA source code?
> Thank you.
>
>
> 在 2016年7月27日星期三 UTC+8上午4:02:45,Will Sargent写道:
>>
>> You can set the "jdk.tls.client.protocols" system property to set options 
>> for the JVM -- this is a feature that is only available in JDK 1.8 though.
>>
>>
>> https://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html#SunJSSE_Protocols
>>
>> Otherwise, you would have to set the security 
>> property jdk.tls.disabledAlgorithms to add TLSv1 specifically.
>>
>>
>> Will Sargent
>> Engineer, Lightbend, Inc.
>>
>>
>> On Tue, Jul 26, 2016 at 1:12 AM,  wrote:
>>
>>> Configure file as follow:
>>> # Protocol to use for SSL encryption, choose from:
>>> # Java 6 & 7:
>>> #   'SSLv3', 'TLSv1'
>>> # Java 7:
>>> #   'TLSv1.1', 'TLSv1.2'
>>> protocol = "TLSv1.2"
>>>
>>>
>>> When I use nmap to scan, I find that TLSv1 is enabled:
>>> D:\softwares\nmap-7.12>nmap -p  --script=ssl* x.x.x.x --unprivileged
>>>
>>>
>>> Starting Nmap 7.12 ( https://nmap.org ) at 2016-07-26 15:33 
>>> °?′óà÷2?±ê×?ê±??
>>> Nmap scan report for x.x.x.x
>>> Host is up (1.0s latency).
>>> PORT STATE  SERVICE
>>> /tcp open unknown
>>> | ssl-enum-ciphers:
>>> |  TLSv1.0:
>>> |ciphers:
>>> |  TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) -A
>>> |compressors:
>>> |  NULL
>>> |cipher preference: indeterminate
>>> |cipher preference error: Too few ciphers supported
>>> |  TLSv1.1:
>>> |ciphers:
>>> |  TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) -A
>>> |compressors:
>>> |  NULL
>>> |cipher preference: indeterminate
>>> |cipher preference error: Too few ciphers supported
>>> |  TLSv1.2:
>>> |ciphers:
>>> |  TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) -A
>>> |compressors:
>>> |  NULL
>>> |cipher preference: indeterminate
>>> |cipher preference error: Too few ciphers supported
>>> |_ least strength: A
>>> MAC Address: xx:xx:xx:xx:xx:xx
>>>
>>>
>>> Nmap done: 1 IP address (1 host up) scanned in 3.88 seconds
>>>
>>>
>>> D:\softwares\nmap-7.12>
>>>
>>> I want to disable TLSv1. Any method?
>>> Thank you.
>>>
>>>
>>> -- 
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ: 
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >> Search the archives: 
>>> https://groups.google.com/group/akka-user
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Microservices Architecture with AKKA Cluster

2016-07-31 Thread Dagny T

Typo on my last comment; meant to say I 'used' the existing Akka Graph DSL. 
 (Definitely didn't write my own!)

On Friday, July 15, 2016 at 9:03:05 AM UTC-7, Maatary Okouya wrote:
>
> Hi,
>
> given that Longom is not working to Scala anytime soon. I wonder if 
> someone could share with some good content on how build a good microservice 
> architecture with AKKA including Recommendation, best practices, things to 
> avoid and so on. 
>
>
> Or if someone as experiences and want to share it here that would be 
> grate. 
>
>
> For instance what are the layer involves from database up to the REST 
> Layer and so on. 
>
>
>

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.