{"action":"created","comment":{"url":"https://api.github.com/repos/debezium/debezium.github.io/pulls/comments/219281446","pull_request_review_id":157420667,"id":219281446,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTI4MTQ0Ng==","diff_hunk":"@@ -0,0 +1,455 @@\n+= Materializing Aggregate Views With Hibernate and Debezium\n+gmorling\n+:awestruct-tags: [ discussion, examples ]\n+:awestruct-layout: blog-post\n+\n+Updating external full text search indexes (e.g. https://www.elastic.co/products/elasticsearch[Elasticsearch]) after data changes is a very popular use case for change data capture (CDC).\n+\n+As we've discussed in a link:/blog/2018/01/17/streaming-to-elasticsearch/[blog post] a while ago,\n+the combination of Debezium's CDC source connectors and Confluent's https://docs.confluent.io/current/connect/connect-elasticsearch/docs/index.html[sink connector for Elasticsearch] makes it straight forward to capture data changes in MySQL, Postgres etc. and push them towards Elastisearch in near real-time.\n+This results in a 1:1 relationship between tables in the source database and a corresponding search index in Elasticsearch,\n+which is perfectly fine for many use cases.\n+\n+It gets more challenging though if you'd like to put entire aggregates into a single index.\n+An example could be a customer and all their addresses;\n+those would typically be stored in two separate tables in an RDBMS, linked by a foreign key,\n+whereas you'd like to have just one index in Elasticsearch,\n+containing documents of customers with their addresses embedded,\n+allowing you to efficiently search for customers based on their address.\n+\n+Following up to the link:/blog/2018/03/08/creating-ddd-aggregates-with-debezium-and-kafka-streams/[KStreams-based solution] to this we described recently,\n+we'd like to present in this post an alternative for materializing such aggregate views driven by the application layer.\n+\n+== Overview\n+\n+The idea is to materialize views in a separate table in the source database,\n+right in the moment the primary data is altered.\n+\n+Aggregates are serialized as JSON structure (which naturally can represent any nested object structure) and stored in a specific table.","path":"blog/2018-09-20-materializinga-ggregate-views-with-hibernate-and-debezium.adoc","position":28,"original_position":28,"commit_id":"b4ed59d96a1b44b86c0a571477875f8c0462af7a","original_commit_id":"b4ed59d96a1b44b86c0a571477875f8c0462af7a","user":{"login":"hpgrahsl","id":7030308,"node_id":"MDQ6VXNlcjcwMzAzMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/7030308?v=4","gravatar_id":"","url":"https://api.github.com/users/hpgrahsl","html_url":"https://github.com/hpgrahsl","followers_url":"https://api.github.com/users/hpgrahsl/followers","following_url":"https://api.github.com/users/hpgrahsl/following{/other_user}","gists_url":"https://api.github.com/users/hpgrahsl/gists{/gist_id}","starred_url":"https://api.github.com/users/hpgrahsl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hpgrahsl/subscriptions","organizations_url":"https://api.github.com/users/hpgrahsl/orgs","repos_url":"https://api.github.com/users/hpgrahsl/repos","events_url":"https://api.github.com/users/hpgrahsl/events{/privacy}","received_events_url":"https://api.github.com/users/hpgrahsl/received_events","type":"User","site_admin":false},"body":"plural? -> JSON structures","created_at":"2018-09-20T19:00:56Z","updated_at":"2018-09-20T19:39:37Z","html_url":"https://github.com/debezium/debezium.github.io/pull/202#discussion_r219281446","pull_request_url":"https://api.github.com/repos/debezium/debezium.github.io/pulls/202","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/debezium/debezium.github.io/pulls/comments/219281446"},"html":{"href":"https://github.com/debezium/debezium.github.io/pull/202#discussion_r219281446"},"pull_request":{"href":"https://api.github.com/repos/debezium/debezium.github.io/pulls/202"}}},"pull_request":{"url":"https://api.github.com/repos/debezium/debezium.github.io/pulls/202","id":217015491,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MDE1NDkx","html_url":"https://github.com/debezium/debezium.github.io/pull/202","diff_url":"https://github.com/debezium/debezium.github.io/pull/202.diff","patch_url":"https://github.com/debezium/debezium.github.io/pull/202.patch","issue_url":"https://api.github.com/repos/debezium/debezium.github.io/issues/202","number":202,"state":"open","locked":false,"title":"Adding blog post on aggregations","user":{"login":"gunnarmorling","id":28612,"node_id":"MDQ6VXNlcjI4NjEy","avatar_url":"https://avatars2.githubusercontent.com/u/28612?v=4","gravatar_id":"","url":"https://api.github.com/users/gunnarmorling","html_url":"https://github.com/gunnarmorling","followers_url":"https://api.github.com/users/gunnarmorling/followers","following_url":"https://api.github.com/users/gunnarmorling/following{/other_user}","gists_url":"https://api.github.com/users/gunnarmorling/gists{/gist_id}","starred_url":"https://api.github.com/users/gunnarmorling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunnarmorling/subscriptions","organizations_url":"https://api.github.com/users/gunnarmorling/orgs","repos_url":"https://api.github.com/users/gunnarmorling/repos","events_url":"https://api.github.com/users/gunnarmorling/events{/privacy}","received_events_url":"https://api.github.com/users/gunnarmorling/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-20T15:30:06Z","updated_at":"2018-09-20T19:39:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edcca130ea4048da3ec040b501e5c64e89f1ace6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/debezium/debezium.github.io/pulls/202/commits","review_comments_url":"https://api.github.com/repos/debezium/debezium.github.io/pulls/202/comments","review_comment_url":"https://api.github.com/repos/debezium/debezium.github.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/debezium/debezium.github.io/issues/202/comments","statuses_url":"https://api.github.com/repos/debezium/debezium.github.io/statuses/b4ed59d96a1b44b86c0a571477875f8c0462af7a","head":{"label":"gunnarmorling:jpa_aggregates","ref":"jpa_aggregates","sha":"b4ed59d96a1b44b86c0a571477875f8c0462af7a","user":{"login":"gunnarmorling","id":28612,"node_id":"MDQ6VXNlcjI4NjEy","avatar_url":"https://avatars2.githubusercontent.com/u/28612?v=4","gravatar_id":"","url":"https://api.github.com/users/gunnarmorling","html_url":"https://github.com/gunnarmorling","followers_url":"https://api.github.com/users/gunnarmorling/followers","following_url":"https://api.github.com/users/gunnarmorling/following{/other_user}","gists_url":"https://api.github.com/users/gunnarmorling/gists{/gist_id}","starred_url":"https://api.github.com/users/gunnarmorling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunnarmorling/subscriptions","organizations_url":"https://api.github.com/users/gunnarmorling/orgs","repos_url":"https://api.github.com/users/gunnarmorling/repos","events_url":"https://api.github.com/users/gunnarmorling/events{/privacy}","received_events_url":"https://api.github.com/users/gunnarmorling/received_events","type":"User","site_admin":false},"repo":{"id":87472811,"node_id":"MDEwOlJlcG9zaXRvcnk4NzQ3MjgxMQ==","name":"debezium.github.io","full_name":"gunnarmorling/debezium.github.io","private":false,"owner":{"login":"gunnarmorling","id":28612,"node_id":"MDQ6VXNlcjI4NjEy","avatar_url":"https://avatars2.githubusercontent.com/u/28612?v=4","gravatar_id":"","url":"https://api.github.com/users/gunnarmorling","html_url":"https://github.com/gunnarmorling","followers_url":"https://api.github.com/users/gunnarmorling/followers","following_url":"https://api.github.com/users/gunnarmorling/following{/other_user}","gists_url":"https://api.github.com/users/gunnarmorling/gists{/gist_id}","starred_url":"https://api.github.com/users/gunnarmorling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunnarmorling/subscriptions","organizations_url":"https://api.github.com/users/gunnarmorling/orgs","repos_url":"https://api.github.com/users/gunnarmorling/repos","events_url":"https://api.github.com/users/gunnarmorling/events{/privacy}","received_events_url":"https://api.github.com/users/gunnarmorling/received_events","type":"User","site_admin":false},"html_url":"https://github.com/gunnarmorling/debezium.github.io","description":"Source for the Debezium website at http://debezium.io Please log issues in our JIRA at https://issues.jboss.org/projects/DBZ/issues","fork":true,"url":"https://api.github.com/repos/gunnarmorling/debezium.github.io","forks_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/forks","keys_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/teams","hooks_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/hooks","issue_events_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/events","assignees_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/tags","blobs_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/languages","stargazers_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/stargazers","contributors_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/contributors","subscribers_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/subscribers","subscription_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/subscription","commits_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/merges","archive_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/downloads","issues_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/labels{/name}","releases_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/gunnarmorling/debezium.github.io/deployments","created_at":"2017-04-06T20:38:50Z","updated_at":"2018-09-19T14:03:00Z","pushed_at":"2018-09-20T17:00:16Z","git_url":"git://github.com/gunnarmorling/debezium.github.io.git","ssh_url":"git@github.com:gunnarmorling/debezium.github.io.git","clone_url":"https://github.com/gunnarmorling/debezium.github.io.git","svn_url":"https://github.com/gunnarmorling/debezium.github.io","homepage":"","size":3829,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"debezium:develop","ref":"develop","sha":"70ea0f462882eb31f13dd16b31bd480345c032ab","user":{"login":"debezium","id":11964329,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExOTY0MzI5","avatar_url":"https://avatars2.githubusercontent.com/u/11964329?v=4","gravatar_id":"","url":"https://api.github.com/users/debezium","html_url":"https://github.com/debezium","followers_url":"https://api.github.com/users/debezium/followers","following_url":"https://api.github.com/users/debezium/following{/other_user}","gists_url":"https://api.github.com/users/debezium/gists{/gist_id}","starred_url":"https://api.github.com/users/debezium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debezium/subscriptions","organizations_url":"https://api.github.com/users/debezium/orgs","repos_url":"https://api.github.com/users/debezium/repos","events_url":"https://api.github.com/users/debezium/events{/privacy}","received_events_url":"https://api.github.com/users/debezium/received_events","type":"Organization","site_admin":false},"repo":{"id":55010150,"node_id":"MDEwOlJlcG9zaXRvcnk1NTAxMDE1MA==","name":"debezium.github.io","full_name":"debezium/debezium.github.io","private":false,"owner":{"login":"debezium","id":11964329,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExOTY0MzI5","avatar_url":"https://avatars2.githubusercontent.com/u/11964329?v=4","gravatar_id":"","url":"https://api.github.com/users/debezium","html_url":"https://github.com/debezium","followers_url":"https://api.github.com/users/debezium/followers","following_url":"https://api.github.com/users/debezium/following{/other_user}","gists_url":"https://api.github.com/users/debezium/gists{/gist_id}","starred_url":"https://api.github.com/users/debezium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debezium/subscriptions","organizations_url":"https://api.github.com/users/debezium/orgs","repos_url":"https://api.github.com/users/debezium/repos","events_url":"https://api.github.com/users/debezium/events{/privacy}","received_events_url":"https://api.github.com/users/debezium/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/debezium/debezium.github.io","description":"Source for the Debezium website at http://debezium.io Please log issues in our JIRA at https://issues.jboss.org/projects/DBZ/issues","fork":false,"url":"https://api.github.com/repos/debezium/debezium.github.io","forks_url":"https://api.github.com/repos/debezium/debezium.github.io/forks","keys_url":"https://api.github.com/repos/debezium/debezium.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/debezium/debezium.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/debezium/debezium.github.io/teams","hooks_url":"https://api.github.com/repos/debezium/debezium.github.io/hooks","issue_events_url":"https://api.github.com/repos/debezium/debezium.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/debezium/debezium.github.io/events","assignees_url":"https://api.github.com/repos/debezium/debezium.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/debezium/debezium.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/debezium/debezium.github.io/tags","blobs_url":"https://api.github.com/repos/debezium/debezium.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/debezium/debezium.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/debezium/debezium.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/debezium/debezium.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/debezium/debezium.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/debezium/debezium.github.io/languages","stargazers_url":"https://api.github.com/repos/debezium/debezium.github.io/stargazers","contributors_url":"https://api.github.com/repos/debezium/debezium.github.io/contributors","subscribers_url":"https://api.github.com/repos/debezium/debezium.github.io/subscribers","subscription_url":"https://api.github.com/repos/debezium/debezium.github.io/subscription","commits_url":"https://api.github.com/repos/debezium/debezium.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/debezium/debezium.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/debezium/debezium.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/debezium/debezium.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/debezium/debezium.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/debezium/debezium.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/debezium/debezium.github.io/merges","archive_url":"https://api.github.com/repos/debezium/debezium.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/debezium/debezium.github.io/downloads","issues_url":"https://api.github.com/repos/debezium/debezium.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/debezium/debezium.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/debezium/debezium.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/debezium/debezium.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/debezium/debezium.github.io/labels{/name}","releases_url":"https://api.github.com/repos/debezium/debezium.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/debezium/debezium.github.io/deployments","created_at":"2016-03-29T20:59:44Z","updated_at":"2018-09-20T08:51:17Z","pushed_at":"2018-09-20T17:00:17Z","git_url":"git://github.com/debezium/debezium.github.io.git","ssh_url":"git@github.com:debezium/debezium.github.io.git","clone_url":"https://github.com/debezium/debezium.github.io.git","svn_url":"https://github.com/debezium/debezium.github.io","homepage":"","size":8915,"stargazers_count":4,"watchers_count":4,"language":"CSS","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":42,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":42,"open_issues":3,"watchers":4,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/debezium/debezium.github.io/pulls/202"},"html":{"href":"https://github.com/debezium/debezium.github.io/pull/202"},"issue":{"href":"https://api.github.com/repos/debezium/debezium.github.io/issues/202"},"comments":{"href":"https://api.github.com/repos/debezium/debezium.github.io/issues/202/comments"},"review_comments":{"href":"https://api.github.com/repos/debezium/debezium.github.io/pulls/202/comments"},"review_comment":{"href":"https://api.github.com/repos/debezium/debezium.github.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/debezium/debezium.github.io/pulls/202/commits"},"statuses":{"href":"https://api.github.com/repos/debezium/debezium.github.io/statuses/b4ed59d96a1b44b86c0a571477875f8c0462af7a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hpgrahsl"}}