Akka persistance custom TCK plugin , How to support non java serialization for Tagged type?
I am building Akka persistence plugin with Apache ignite , I have a question when it comes to event tagging , if i disable java serialization(allow-java-serialization = no) , Tagged type failed to be serialized properly as i am using Protobuf for events , is there a way to configure specific serialization for Event Tagged wrapper or it need to be handled in the plugin itself?
The GitHub for my plugin : https://github.com/Romeh/akka-persistance-ignite
The exception I get is :
[2018-11-21 21:20:48] [orderManagerSystem-akka.actor.default-dispatcher-27] ERROR a.p.i.journal.IgniteWriteJournal - Attempted to serialize message using Java serialization while akka.actor.allow-java-serialization
was disabled. Check WARNING logs for more details.
akka.serialization.DisabledJavaSerializer$JavaSerializationException: Attempted to serialize message using Java serialization while akka.actor.allow-java-serialization
was disabled. Check WARNING logs for more details.
[2018-11-21 21:20:48] [orderManagerSystem-akka.actor.default-dispatcher-11] WARN a.s.DisabledJavaSerializer - Outgoing message attempted to use Java Serialization even though akka.actor.allow-java-serialization = off
was set! Message type was: [class akka.persistence.journal.Tagged]
I have a sample application where this issue is happening for me where I use Protobuf for events serialization , do I need to do the same for event Tagged type ?
GitHub URL example code :
https://github.com/Romeh/spring-boot-akka-event-sourcing-starter/tree/master/spring-event-sourcing-example
In Apache ignite , it is binary serialization .
Thx a lot for your help!
serialization akka ignite akka-persistence
add a comment |
I am building Akka persistence plugin with Apache ignite , I have a question when it comes to event tagging , if i disable java serialization(allow-java-serialization = no) , Tagged type failed to be serialized properly as i am using Protobuf for events , is there a way to configure specific serialization for Event Tagged wrapper or it need to be handled in the plugin itself?
The GitHub for my plugin : https://github.com/Romeh/akka-persistance-ignite
The exception I get is :
[2018-11-21 21:20:48] [orderManagerSystem-akka.actor.default-dispatcher-27] ERROR a.p.i.journal.IgniteWriteJournal - Attempted to serialize message using Java serialization while akka.actor.allow-java-serialization
was disabled. Check WARNING logs for more details.
akka.serialization.DisabledJavaSerializer$JavaSerializationException: Attempted to serialize message using Java serialization while akka.actor.allow-java-serialization
was disabled. Check WARNING logs for more details.
[2018-11-21 21:20:48] [orderManagerSystem-akka.actor.default-dispatcher-11] WARN a.s.DisabledJavaSerializer - Outgoing message attempted to use Java Serialization even though akka.actor.allow-java-serialization = off
was set! Message type was: [class akka.persistence.journal.Tagged]
I have a sample application where this issue is happening for me where I use Protobuf for events serialization , do I need to do the same for event Tagged type ?
GitHub URL example code :
https://github.com/Romeh/spring-boot-akka-event-sourcing-starter/tree/master/spring-event-sourcing-example
In Apache ignite , it is binary serialization .
Thx a lot for your help!
serialization akka ignite akka-persistence
add a comment |
I am building Akka persistence plugin with Apache ignite , I have a question when it comes to event tagging , if i disable java serialization(allow-java-serialization = no) , Tagged type failed to be serialized properly as i am using Protobuf for events , is there a way to configure specific serialization for Event Tagged wrapper or it need to be handled in the plugin itself?
The GitHub for my plugin : https://github.com/Romeh/akka-persistance-ignite
The exception I get is :
[2018-11-21 21:20:48] [orderManagerSystem-akka.actor.default-dispatcher-27] ERROR a.p.i.journal.IgniteWriteJournal - Attempted to serialize message using Java serialization while akka.actor.allow-java-serialization
was disabled. Check WARNING logs for more details.
akka.serialization.DisabledJavaSerializer$JavaSerializationException: Attempted to serialize message using Java serialization while akka.actor.allow-java-serialization
was disabled. Check WARNING logs for more details.
[2018-11-21 21:20:48] [orderManagerSystem-akka.actor.default-dispatcher-11] WARN a.s.DisabledJavaSerializer - Outgoing message attempted to use Java Serialization even though akka.actor.allow-java-serialization = off
was set! Message type was: [class akka.persistence.journal.Tagged]
I have a sample application where this issue is happening for me where I use Protobuf for events serialization , do I need to do the same for event Tagged type ?
GitHub URL example code :
https://github.com/Romeh/spring-boot-akka-event-sourcing-starter/tree/master/spring-event-sourcing-example
In Apache ignite , it is binary serialization .
Thx a lot for your help!
serialization akka ignite akka-persistence
I am building Akka persistence plugin with Apache ignite , I have a question when it comes to event tagging , if i disable java serialization(allow-java-serialization = no) , Tagged type failed to be serialized properly as i am using Protobuf for events , is there a way to configure specific serialization for Event Tagged wrapper or it need to be handled in the plugin itself?
The GitHub for my plugin : https://github.com/Romeh/akka-persistance-ignite
The exception I get is :
[2018-11-21 21:20:48] [orderManagerSystem-akka.actor.default-dispatcher-27] ERROR a.p.i.journal.IgniteWriteJournal - Attempted to serialize message using Java serialization while akka.actor.allow-java-serialization
was disabled. Check WARNING logs for more details.
akka.serialization.DisabledJavaSerializer$JavaSerializationException: Attempted to serialize message using Java serialization while akka.actor.allow-java-serialization
was disabled. Check WARNING logs for more details.
[2018-11-21 21:20:48] [orderManagerSystem-akka.actor.default-dispatcher-11] WARN a.s.DisabledJavaSerializer - Outgoing message attempted to use Java Serialization even though akka.actor.allow-java-serialization = off
was set! Message type was: [class akka.persistence.journal.Tagged]
I have a sample application where this issue is happening for me where I use Protobuf for events serialization , do I need to do the same for event Tagged type ?
GitHub URL example code :
https://github.com/Romeh/spring-boot-akka-event-sourcing-starter/tree/master/spring-event-sourcing-example
In Apache ignite , it is binary serialization .
Thx a lot for your help!
serialization akka ignite akka-persistence
serialization akka ignite akka-persistence
asked Nov 21 '18 at 20:30
Mahmoud RomehMahmoud Romeh
225
225
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Judging from your workflow diagram, Akka persistence comes first so you have to convince it to pass non-Serializable objects to Apache Ignite as is.
I guess you could either
- Specify an
akka.serialization.Serializer
implementation for Protobuf which will turn Protobuf toArray[Byte]
- Specify an
akka.serialization.Serializer
implementation which will leverage Apache Ignite's BinaryMarshaller.marshal(Object). Note that Apache Ignite will not be aware that BinaryObject is being stored in its caches, but treat it asbyte
, unless you add some kind of extra handling.
Thx a lot for your answer , i agree with you completely in your explanation , i was asking if we can define custom serializer for Tagged class rather than default Java serialization as i want to switch off Java serialization completely in Akka
– Mahmoud Romeh
Nov 27 '18 at 7:25
I think Akka is going to turn your objects toArray[Byte]
one way or another.
– alamar
Nov 27 '18 at 9:43
add a comment |
Actually the issue got fixed by checking the msg type if it is Tagged event or not before doing the actual event storing in the journal , something like :
private JournalItem convert(PersistentRepr p) {
if (p.payload() instanceof Tagged) {
Tagged taggedMsg = (Tagged) p.payload();
PersistentRepr persistentReprWithoutTag = new PersistentImpl(taggedMsg.payload(), p.sequenceNr(), p.persistenceId(), p.manifest(), p.deleted(), p.sender(), p.writerUuid());
return new JournalItem(persistentReprWithoutTag.sequenceNr(), persistentReprWithoutTag.persistenceId(), serializer.toBinary(persistentReprWithoutTag), JavaConverters.asJavaCollection(taggedMsg.tags()));
} else {
return new JournalItem(p.sequenceNr(), p.persistenceId(), serializer.toBinary(p), null);
}
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420039%2fakka-persistance-custom-tck-plugin-how-to-support-non-java-serialization-for-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Judging from your workflow diagram, Akka persistence comes first so you have to convince it to pass non-Serializable objects to Apache Ignite as is.
I guess you could either
- Specify an
akka.serialization.Serializer
implementation for Protobuf which will turn Protobuf toArray[Byte]
- Specify an
akka.serialization.Serializer
implementation which will leverage Apache Ignite's BinaryMarshaller.marshal(Object). Note that Apache Ignite will not be aware that BinaryObject is being stored in its caches, but treat it asbyte
, unless you add some kind of extra handling.
Thx a lot for your answer , i agree with you completely in your explanation , i was asking if we can define custom serializer for Tagged class rather than default Java serialization as i want to switch off Java serialization completely in Akka
– Mahmoud Romeh
Nov 27 '18 at 7:25
I think Akka is going to turn your objects toArray[Byte]
one way or another.
– alamar
Nov 27 '18 at 9:43
add a comment |
Judging from your workflow diagram, Akka persistence comes first so you have to convince it to pass non-Serializable objects to Apache Ignite as is.
I guess you could either
- Specify an
akka.serialization.Serializer
implementation for Protobuf which will turn Protobuf toArray[Byte]
- Specify an
akka.serialization.Serializer
implementation which will leverage Apache Ignite's BinaryMarshaller.marshal(Object). Note that Apache Ignite will not be aware that BinaryObject is being stored in its caches, but treat it asbyte
, unless you add some kind of extra handling.
Thx a lot for your answer , i agree with you completely in your explanation , i was asking if we can define custom serializer for Tagged class rather than default Java serialization as i want to switch off Java serialization completely in Akka
– Mahmoud Romeh
Nov 27 '18 at 7:25
I think Akka is going to turn your objects toArray[Byte]
one way or another.
– alamar
Nov 27 '18 at 9:43
add a comment |
Judging from your workflow diagram, Akka persistence comes first so you have to convince it to pass non-Serializable objects to Apache Ignite as is.
I guess you could either
- Specify an
akka.serialization.Serializer
implementation for Protobuf which will turn Protobuf toArray[Byte]
- Specify an
akka.serialization.Serializer
implementation which will leverage Apache Ignite's BinaryMarshaller.marshal(Object). Note that Apache Ignite will not be aware that BinaryObject is being stored in its caches, but treat it asbyte
, unless you add some kind of extra handling.
Judging from your workflow diagram, Akka persistence comes first so you have to convince it to pass non-Serializable objects to Apache Ignite as is.
I guess you could either
- Specify an
akka.serialization.Serializer
implementation for Protobuf which will turn Protobuf toArray[Byte]
- Specify an
akka.serialization.Serializer
implementation which will leverage Apache Ignite's BinaryMarshaller.marshal(Object). Note that Apache Ignite will not be aware that BinaryObject is being stored in its caches, but treat it asbyte
, unless you add some kind of extra handling.
answered Nov 22 '18 at 8:54
alamaralamar
11k25075
11k25075
Thx a lot for your answer , i agree with you completely in your explanation , i was asking if we can define custom serializer for Tagged class rather than default Java serialization as i want to switch off Java serialization completely in Akka
– Mahmoud Romeh
Nov 27 '18 at 7:25
I think Akka is going to turn your objects toArray[Byte]
one way or another.
– alamar
Nov 27 '18 at 9:43
add a comment |
Thx a lot for your answer , i agree with you completely in your explanation , i was asking if we can define custom serializer for Tagged class rather than default Java serialization as i want to switch off Java serialization completely in Akka
– Mahmoud Romeh
Nov 27 '18 at 7:25
I think Akka is going to turn your objects toArray[Byte]
one way or another.
– alamar
Nov 27 '18 at 9:43
Thx a lot for your answer , i agree with you completely in your explanation , i was asking if we can define custom serializer for Tagged class rather than default Java serialization as i want to switch off Java serialization completely in Akka
– Mahmoud Romeh
Nov 27 '18 at 7:25
Thx a lot for your answer , i agree with you completely in your explanation , i was asking if we can define custom serializer for Tagged class rather than default Java serialization as i want to switch off Java serialization completely in Akka
– Mahmoud Romeh
Nov 27 '18 at 7:25
I think Akka is going to turn your objects to
Array[Byte]
one way or another.– alamar
Nov 27 '18 at 9:43
I think Akka is going to turn your objects to
Array[Byte]
one way or another.– alamar
Nov 27 '18 at 9:43
add a comment |
Actually the issue got fixed by checking the msg type if it is Tagged event or not before doing the actual event storing in the journal , something like :
private JournalItem convert(PersistentRepr p) {
if (p.payload() instanceof Tagged) {
Tagged taggedMsg = (Tagged) p.payload();
PersistentRepr persistentReprWithoutTag = new PersistentImpl(taggedMsg.payload(), p.sequenceNr(), p.persistenceId(), p.manifest(), p.deleted(), p.sender(), p.writerUuid());
return new JournalItem(persistentReprWithoutTag.sequenceNr(), persistentReprWithoutTag.persistenceId(), serializer.toBinary(persistentReprWithoutTag), JavaConverters.asJavaCollection(taggedMsg.tags()));
} else {
return new JournalItem(p.sequenceNr(), p.persistenceId(), serializer.toBinary(p), null);
}
}
add a comment |
Actually the issue got fixed by checking the msg type if it is Tagged event or not before doing the actual event storing in the journal , something like :
private JournalItem convert(PersistentRepr p) {
if (p.payload() instanceof Tagged) {
Tagged taggedMsg = (Tagged) p.payload();
PersistentRepr persistentReprWithoutTag = new PersistentImpl(taggedMsg.payload(), p.sequenceNr(), p.persistenceId(), p.manifest(), p.deleted(), p.sender(), p.writerUuid());
return new JournalItem(persistentReprWithoutTag.sequenceNr(), persistentReprWithoutTag.persistenceId(), serializer.toBinary(persistentReprWithoutTag), JavaConverters.asJavaCollection(taggedMsg.tags()));
} else {
return new JournalItem(p.sequenceNr(), p.persistenceId(), serializer.toBinary(p), null);
}
}
add a comment |
Actually the issue got fixed by checking the msg type if it is Tagged event or not before doing the actual event storing in the journal , something like :
private JournalItem convert(PersistentRepr p) {
if (p.payload() instanceof Tagged) {
Tagged taggedMsg = (Tagged) p.payload();
PersistentRepr persistentReprWithoutTag = new PersistentImpl(taggedMsg.payload(), p.sequenceNr(), p.persistenceId(), p.manifest(), p.deleted(), p.sender(), p.writerUuid());
return new JournalItem(persistentReprWithoutTag.sequenceNr(), persistentReprWithoutTag.persistenceId(), serializer.toBinary(persistentReprWithoutTag), JavaConverters.asJavaCollection(taggedMsg.tags()));
} else {
return new JournalItem(p.sequenceNr(), p.persistenceId(), serializer.toBinary(p), null);
}
}
Actually the issue got fixed by checking the msg type if it is Tagged event or not before doing the actual event storing in the journal , something like :
private JournalItem convert(PersistentRepr p) {
if (p.payload() instanceof Tagged) {
Tagged taggedMsg = (Tagged) p.payload();
PersistentRepr persistentReprWithoutTag = new PersistentImpl(taggedMsg.payload(), p.sequenceNr(), p.persistenceId(), p.manifest(), p.deleted(), p.sender(), p.writerUuid());
return new JournalItem(persistentReprWithoutTag.sequenceNr(), persistentReprWithoutTag.persistenceId(), serializer.toBinary(persistentReprWithoutTag), JavaConverters.asJavaCollection(taggedMsg.tags()));
} else {
return new JournalItem(p.sequenceNr(), p.persistenceId(), serializer.toBinary(p), null);
}
}
answered Nov 29 '18 at 14:31
Mahmoud RomehMahmoud Romeh
225
225
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420039%2fakka-persistance-custom-tck-plugin-how-to-support-non-java-serialization-for-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown