Human readable Events in SQL event store


We are developing a solution based on the AxonFramework version 2.4.1
We are getting close to our go live date, so we cannot realistically move to a different Axon version.

What we are currently seeing in our event data store (using postgreSQL,) are events which are not Human Readable.
We have implemented an Event Visitor which can retrieve events and everything looks fine, so the event content is behaving fine.

However, if we look directly at the domainevententry, an event payload will look something like this:


Is this expected ?

Is there a way of improving the human readability of these raw domain events (e.g. to show the event payload as XML) ?

A key concern from the System Support team is that the do not feel that they could support the system if they cannot understand the stored event data.

Many Thanks,


That’s the PostgreSQL client showing the data of a binary column as hexadecimal. The Axon SQL schema uses a binary column because the application might decide to use a non-human-readable serialization format, e.g., the Java serializer.

You can try the built-in PostgreSQL “encode” function to tell it to render the binary data as text, e.g.,

SELECT encode(payload, ‘escape’) FROM domainevententry;


You Sir are an absolute star - many thanks !


Since you’re using Postgresql, you might consider:

  • Using Jackson/JSON as the domain event serializer
  • Storing the data in a JSONB column

Getting Axon to support JSONB data types requires implementing an adapter, but it’s pretty
straight forward when using the JDBC Domain Event Repository. In my version (see below)
I’ve also modified the column names, but that’s not neccesary, so you can get away with
overriding much less code.

I’ve found JSONB to be very helpful – it lets you do meaningful queries when you’re e.g. wondering
what type of event payloads are actually being used, or for re-writing events when it’s not possible
to upcast the values in your upcaster chain.

Once that’s done, you can easily query e.g.

select payload->>‘menuOption’, count(*) from … events … group by payload->>‘menuOption’;

 * SQL schema supporting postgres databases and our JPA naming convention.
 * <p>
 * Payload and metadata are stored either as byte[] (DB2, H2) or JSONB (postgresql).

Hi Patrick,

I’m interested in using Postrgres with JsonB for our Event store…
Because well —> JSON :slight_smile:

Could you tell me how exactly how one goes about plugging in the custom GenericEventSqlSchema and serializing to JSON?


Hi Kirk,

The basic documentation for setting up the JDBC event store is here:

My particular configuration looks like this:

<bean id="eventStoreSqlSchema" class="com.expd.rates.infrastructure.orm.CustomEventSqlSchema">
    <constructor-arg name="schemaConfiguration">
        <bean class="org.axonframework.eventstore.jdbc.SchemaConfiguration">
            <constructor-arg name="eventEntryTable" value="schemaname.domain_event_entry"/>
            <constructor-arg name="snapshotEntryTable" value="schemaname.snapshot_event_entry"/>
    <constructor-arg name="dialect" value="${datasource.dialect}" />

<bean id="axonConnectionProvider" class="org.axonframework.common.jdbc.SpringDataSourceConnectionProvider">
    <constructor-arg ref="dataSource"/>

<bean id="eventStore" primary="true" class="org.axonframework.eventstore.jdbc.JdbcEventStore">
    <constructor-arg name="eventEntryStore">
        <bean class="org.axonframework.eventstore.jdbc.DefaultEventEntryStore">
            <constructor-arg name="connectionProvider" ref="axonConnectionProvider" />
            <constructor-arg name="sqlSchema" ref="eventStoreSqlSchema" />
    <constructor-arg name="serializer" ref="axonJsonSerializer"/>
    <!--<property name="persistenceExceptionResolver" ref="axonPersistenceExceptionResolver" />-->
    <property name="upcasterChain" ref="upcasterChain"/>