Re: [akka-user] Akka HTTP/JSON: Rejecting requests with unknown fields

2017-03-28 Thread Alan Burlison

On 28/03/2017 22:51, Konrad Malawski wrote:


Your unmarshaller (you did not say what you're using), should be configured
to blow up then.


The default Akka/HTTP one, namely Spray/JSON.


The spray-json one can not do that.


That's unfortunate :-(

Is it possible in principle to extend it to reject unrecognised fields, 
or is it a case of having to switch to a different framework? I'm also 
using Spray/JSON to implement Akka persistence and I don't want to have 
2 JSOn frameworks in the same app, so switching to another JSON 
framework would not be trivial.


Thanks,

--
Alan Burlison
--

--

 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] Akka HTTP/JSON: Rejecting requests with unknown fields

2017-03-28 Thread Konrad Malawski
Your unmarshaller (you did not say what you're using), should be configured
to blow up then.
The spray-json one can not do that.

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 28 March 2017 at 23:37:57, Alan Burlison (alan.burli...@gmail.com) wrote:

I'm using Akka's HTTP/JSON support to unmarshall JSON to case clasess
using the standard "entity" and "as" mechanism. It works fine but if I
supply JSON fields that don't have any corresponding case class fields
they are silently ignored whereas I need the request to be rejected. I
can't find any obvious way of doing this, is there one?

Thanks,

-- 
Alan Burlison
-- 

-- 
>> 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.

-- 
>>  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] Akka HTTP/JSON: Rejecting requests with unknown fields

2017-03-28 Thread Alan Burlison
I'm using Akka's HTTP/JSON support to unmarshall JSON to case clasess
using the standard "entity" and "as" mechanism. It works fine but if I
supply JSON fields that don't have any corresponding case class fields
they are silently ignored whereas I need the request to be rejected. I
can't find any obvious way of doing this, is there one?

Thanks,

-- 
Alan Burlison
--

-- 
>>  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] akka-streams-kafka exponential backoff

2017-03-28 Thread 'Michal Borowiecki' via Akka User List

Hello,

Lagom has a nice feature when subscribing to kafka topics that upon 
failure it re-creates the flow with exponential backoff.


I see this is implemented by wrapping the KafkaSubscriberActor props 
with BackoffSupervisor props:


https://github.com/lagom/lagom/blob/master/service/scaladsl/kafka/client/src/main/scala/com/lightbend/lagom/internal/scaladsl/broker/kafka/ScaladslKafkaSubscriber.scala#L105


What is the best way to implement the same using akka-streams-kafka 
directly?


Having read 
http://doc.akka.io/docs/akka/2.4.17/java/stream/stream-error.html I 
thought the way would be via ActorMaterializerSettings but I can't 
figure out how and I'm hoping that for someone here it will be an easy 
question.


Cheers,

Michal

--
Signature
 Michal Borowiecki
Senior Software Engineer L4
T:  +44 208 742 1600


+44 203 249 8448



E:  michal.borowie...@openbet.com
W:  www.openbet.com 


OpenBet Ltd

Chiswick Park Building 9

566 Chiswick High Rd

London

W4 5XT

UK




This message is confidential and intended only for the addressee. If you 
have received this message in error, please immediately notify the 
postmas...@openbet.com  and delete it 
from your system as well as any copies. The content of e-mails as well 
as traffic data may be monitored by OpenBet for employment and security 
purposes. To protect the environment please do not print this e-mail 
unless necessary. OpenBet Ltd. Registered Office: Chiswick Park Building 
9, 566 Chiswick High Road, London, W4 5XT, United Kingdom. A company 
registered in England and Wales. Registered no. 3134634. VAT no. 
GB927523612


--

 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: Unable to join Akka cluster

2017-03-28 Thread Anton Gerbracht
Sorry this error I think is being caused by my seed node being an akka 2.3 
cluster:

[error] a.r.Remoting - Unimplemented deserialization of message with 
manifest [akka.contrib.pattern.DistributedPubSubMediator$Internal$Status] 
in [akka.cluster.pubsub.protobuf.DistributedPubSubMessageSerializer]
java.lang.IllegalArgumentException: Unimplemented deserialization of 
message with manifest 
[akka.contrib.pattern.DistributedPubSubMediator$Internal$Status] in 
[akka.cluster.pubsub.protobuf.DistributedPubSubMessageSerializer]
at 
akka.cluster.pubsub.protobuf.DistributedPubSubMessageSerializer.fromBinary(DistributedPubSubMessageSerializer.scala:75)
at 
akka.serialization.Serialization.akka$serialization$Serialization$$deserializeByteArray(Serialization.scala:148)
at 
akka.serialization.Serialization$$anonfun$deserialize$2.apply(Serialization.scala:137)
at scala.util.Try$.apply(Try.scala:192)
at 
akka.serialization.Serialization.deserialize(Serialization.scala:131)
at 
akka.remote.serialization.MessageContainerSerializer.fromBinary(MessageContainerSerializer.scala:80)
at 
akka.serialization.Serialization.akka$serialization$Serialization$$deserializeByteArray(Serialization.scala:151)
at 
akka.serialization.Serialization$$anonfun$deserialize$2.apply(Serialization.scala:137)
at scala.util.Try$.apply(Try.scala:192)
at 
akka.serialization.Serialization.deserialize(Serialization.scala:131)


On Friday, March 24, 2017 at 3:13:00 AM UTC-5, Russ Goldstein wrote:
>
> Hello,
> I am writing a Scala Play application (Play version 2.5 using Akka 2.4.12 
> on Scala 2.11) in which I would like it to join to seed nodes.  These seed 
> nodes are within a Java application (running Akka 2.4.12 on Java 8).  The 
> application.conf snippet pertaining to Akka looks as follows:
>
> play.akka.actor-system="MyActorSystem"
>
> akka {
>   actor {
> provider = "akka.cluster.ClusterActorRefProvider"
> serializers {
>   java = "akka.serialization.JavaSerializer"
> }
> serialization-bindings {
>   "java.util.Serializable" = java #just using this for testing purposes
> }
>   }
>   remote {
> log-remote-lifecycle-events = off
> netty.tcp {
>   hostname = localhost
>   port = 9076
> }
>   }
>   cluster {
> seed-nodes = [
>   "akka.tcp://MyActorSystem@localhost:9079" #seeding application is on 
> same server
> ]
> auto-down-unreachable-after = 10s
> metrics {
>   enabled = off
> }
>   }
> }
>
>
> When I try to start the play application, the following error occurs:
>
> [error] a.r.Remoting - Cannot find serializer with id [9]. The most 
> probable reason is that the configuration entry akka.actor.serializers is 
> not in synch between the two systems.
> java.io.NotSerializableException: Cannot find serializer with id [9]. The 
> most probable reason is that the configuration entry akka.actor.serializers 
> is not in synch between the two systems.
> at 
> akka.serialization.Serialization$$anonfun$deserialize$2.apply(Serialization.scala:133)
> at scala.util.Try$.apply(Try.scala:192)
> at akka.serialization.Serialization.deserialize(Serialization.scala:131)
> at 
> akka.remote.serialization.MessageContainerSerializer.fromBinary(MessageContainerSerializer.scala:80)
> at 
> akka.serialization.Serialization.akka$serialization$Serialization$$deserializeByteArray(Serialization.scala:151)
> at 
> akka.serialization.Serialization$$anonfun$deserialize$2.apply(Serialization.scala:137)
> at scala.util.Try$.apply(Try.scala:192)
> at akka.serialization.Serialization.deserialize(Serialization.scala:131)
> at akka.remote.MessageSerializer$.deserialize(MessageSerializer.scala:30)
> at 
> akka.remote.DefaultMessageDispatcher.payload$lzycompute$1(Endpoint.scala:64)
>
> Any help would be greatly appreciated.
>
> Thanks,
> Russ
>

-- 
>>  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: Unable to join Akka cluster

2017-03-28 Thread Anton Gerbracht
Added the akka-cluster-tool jar to provide the missing 
serializer. Serializer 9 is DistributedPubSubMessageSerializer

now getting this error:

[error] a.r.Remoting - Unimplemented deserialization of message with 
manifest [akka.contrib.pattern.DistributedPubSubMediator$Internal$Status] 
in [akka.cluster.pubsub.protobuf.DistributedPubSubMessageSerializer]
java.lang.IllegalArgumentException: Unimplemented deserialization of 
message with manifest 
[akka.contrib.pattern.DistributedPubSubMediator$Internal$Status] in 
[akka.cluster.pubsub.protobuf.DistributedPubSubMessageSerializer]
at 
akka.cluster.pubsub.protobuf.DistributedPubSubMessageSerializer.fromBinary(DistributedPubSubMessageSerializer.scala:75)
at 
akka.serialization.Serialization.akka$serialization$Serialization$$deserializeByteArray(Serialization.scala:148)
at 
akka.serialization.Serialization$$anonfun$deserialize$2.apply(Serialization.scala:137)
at scala.util.Try$.apply(Try.scala:192)
at 
akka.serialization.Serialization.deserialize(Serialization.scala:131)
at 
akka.remote.serialization.MessageContainerSerializer.fromBinary(MessageContainerSerializer.scala:80)
at 
akka.serialization.Serialization.akka$serialization$Serialization$$deserializeByteArray(Serialization.scala:151)
at 
akka.serialization.Serialization$$anonfun$deserialize$2.apply(Serialization.scala:137)
at scala.util.Try$.apply(Try.scala:192)
at 
akka.serialization.Serialization.deserialize(Serialization.scala:131)

On Friday, March 24, 2017 at 3:13:00 AM UTC-5, Russ Goldstein wrote:
>
> Hello,
> I am writing a Scala Play application (Play version 2.5 using Akka 2.4.12 
> on Scala 2.11) in which I would like it to join to seed nodes.  These seed 
> nodes are within a Java application (running Akka 2.4.12 on Java 8).  The 
> application.conf snippet pertaining to Akka looks as follows:
>
> play.akka.actor-system="MyActorSystem"
>
> akka {
>   actor {
> provider = "akka.cluster.ClusterActorRefProvider"
> serializers {
>   java = "akka.serialization.JavaSerializer"
> }
> serialization-bindings {
>   "java.util.Serializable" = java #just using this for testing purposes
> }
>   }
>   remote {
> log-remote-lifecycle-events = off
> netty.tcp {
>   hostname = localhost
>   port = 9076
> }
>   }
>   cluster {
> seed-nodes = [
>   "akka.tcp://MyActorSystem@localhost:9079" #seeding application is on 
> same server
> ]
> auto-down-unreachable-after = 10s
> metrics {
>   enabled = off
> }
>   }
> }
>
>
> When I try to start the play application, the following error occurs:
>
> [error] a.r.Remoting - Cannot find serializer with id [9]. The most 
> probable reason is that the configuration entry akka.actor.serializers is 
> not in synch between the two systems.
> java.io.NotSerializableException: Cannot find serializer with id [9]. The 
> most probable reason is that the configuration entry akka.actor.serializers 
> is not in synch between the two systems.
> at 
> akka.serialization.Serialization$$anonfun$deserialize$2.apply(Serialization.scala:133)
> at scala.util.Try$.apply(Try.scala:192)
> at akka.serialization.Serialization.deserialize(Serialization.scala:131)
> at 
> akka.remote.serialization.MessageContainerSerializer.fromBinary(MessageContainerSerializer.scala:80)
> at 
> akka.serialization.Serialization.akka$serialization$Serialization$$deserializeByteArray(Serialization.scala:151)
> at 
> akka.serialization.Serialization$$anonfun$deserialize$2.apply(Serialization.scala:137)
> at scala.util.Try$.apply(Try.scala:192)
> at akka.serialization.Serialization.deserialize(Serialization.scala:131)
> at akka.remote.MessageSerializer$.deserialize(MessageSerializer.scala:30)
> at 
> akka.remote.DefaultMessageDispatcher.payload$lzycompute$1(Endpoint.scala:64)
>
> Any help would be greatly appreciated.
>
> Thanks,
> Russ
>

-- 
>>  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] transactors and STM are gone. What conception to use instead?

2017-03-28 Thread Rafał Krzewski
FWIW, there's https://github.com/nbronson/scala-stm. It doesn't seem to be 
actively developed at the moment, but the most recent release was in 
November 2017. 
There's no 2.12 release and some changes are needed, 
see https://github.com/nbronson/scala-stm/issues/53
If you are interested in this kind of approach, getting involved with that 
project could be a better way forward than ripping out old code from Akka.

W dniu niedziela, 19 marca 2017 17:56:44 UTC+1 użytkownik Justin du coeur 
napisał:
>
> On Sat, Mar 18, 2017 at 4:23 PM, scala solist  > wrote:
>
>> So now I'm still using akka for single-JVM multitasking and has no desire 
>> to go back to synchronized. So I need to program local transactions 
>> somehow. It is definitely feasible since it could be done in single-JVM 
>> with synchronized. But I'd like to find idiomatic actor way.
>>
>
> I don't know if you're going to find anything that is meaningfully 
> idiomatic for the current world, given that distributed is pretty integral 
> to the current idiom.  But I suspect that the best way to start may be to 
> look at the old transactors and STM, and see if that code can be revived as 
> an external library.  I don't know offhand whether that's possible, but it 
> likely at least would provide good guidance... 
>

-- 
>>  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] Slowing down Akka HTTP responses

2017-03-28 Thread Alan Burlison
I'm working on a simulation using Akka HTTP where the HTTP responses 
from the real system can have significant delays that I need to 
replicate. Doing this the simple way by blocking on a sleep would 
obviously not be a good choice so I'm wondering on how to do this? One 
idea is to use the Akka Scheduler 
(http://doc.akka.io/docs/akka/current/scala/scheduler.html) to send a 
message back to the HTTP actor after a delay containing the response to 
send back to the client, but I'm wondering if there's a smarter way to 
do this?


Thanks,

--
Alan Burlison
--

--

 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] Akka Stream- How to use Slick as Subscriber(Sink) to data into Database.

2017-03-28 Thread Konrad Malawski
AFAIR they have not implemented streaming inserts.

Just data.mapAsync()(insert).



-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 28 March 2017 at 10:19:50, DEEPAK GUPTA (vnitdee...@gmail.com) wrote:

Akka Stream- How to use Slick as Subscriber(Sink) to data into Database.
Example will help a lot
--
>> 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.

-- 
>>  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] Akka Stream- How to use Slick as Subscriber(Sink) to data into Database.

2017-03-28 Thread DEEPAK GUPTA
Akka Stream- How to use Slick as Subscriber(Sink) to data into Database.
Example will help a lot

-- 
>>  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.