diff --git a/docs/modules/mapstore/pages/configuring-a-generic-maploader.adoc b/docs/modules/mapstore/pages/configuring-a-generic-maploader.adoc index c1abd38aa..4752a4731 100644 --- a/docs/modules/mapstore/pages/configuring-a-generic-maploader.adoc +++ b/docs/modules/mapstore/pages/configuring-a-generic-maploader.adoc @@ -1,16 +1,37 @@ -= Using the Generic MapLoader += Using the generic MapLoader :description: With the xref:working-with-external-data.adoc#options[generic MapLoader], you can configure a map to cache data from an external system. This topic includes an example of how to configure a map with a generic MapLoader that connects to a MySQL database. :page-beta: false {description} +NOTE: The objects created in the distributed map are stored as GenericRecord. You can use the `type-name` property to store the data in a POJO (Plain Old Java Object). + For a list of all supported external systems, including databases, see available xref:external-data-stores:external-data-stores.adoc#connectors[data connection types]. -== Before you Begin +== Before you begin You need a xref:external-data-stores:external-data-stores.adoc[data connection] that's configured on all cluster members. -== Quickstart Configuration +== Add dependencies + +If you are using a Hazelcast JAR file, you need to ensure the following is added to your classpath: + +[source,xml] +---- + + com.hazelcast + hazelcast-sql + + + + com.hazelcast + hazelcast-mapstore + +---- + +NOTE: If you are using the slim distribution, you need to add `hazelcast-mapstore`. If you are using MongoDb, you also need to add `hazelcast-jet-mongodb`. + +== Quickstart configuration This example shows a basic map configuration that uses a data connection called `my-mysql-database`. See xref:data-structures:map.adoc[] for the details of other properties that you can include in your map configuration. @@ -70,11 +91,11 @@ instance().getConfig().addMapConfig(mapConfig); <2> The name of your data connection. [[mapping]] -== SQL Mapping for the Generic MapLoader +== SQL mapping for the generic MapLoader -When you configure a map with the generic MapLoader, Hazelcast creates a xref:sql:mapping-to-jdbc.adoc[SQL mapping with the JDBC connector]. The name of the mapping is the same name as your map prefixed with `__map-store.`. This mapping is used to read data from the external system, and it is removed whenever the configured map is removed. You can also configure this SQL mapping, using <>. +When you configure a map with the generic MapLoader, Hazelcast creates a xref:sql:mapping-to-jdbc.adoc[SQL mapping with the JDBC connector]. The name of the mapping is the same name as your map prefixed with `__map-store.`. This mapping is used to read data from the external system, and is removed whenever the configured map is removed. You can also configure this SQL mapping, using <>. -== Configuration Properties for the Generic MapLoader +== Configuration properties for the generic MapLoader These configuration properties allow you to configure the generic MapLoader and its SQL mapping. @@ -436,19 +457,19 @@ mapConfig.setMapStoreConfig(mapStoreConfig); == Supported backends -GenericMapStore needs a SQL Connector that supports `SELECT`, `UPDATE`, `SINK INTO` and `DELETE` statements. +The generic MapStore needs a SQL Connector that supports `SELECT`, `UPDATE`, `SINK INTO` and `DELETE` statements. Officially supported connectors: - MySQL, PostgreSQL, Microsoft SQL Server, Oracle (it uses JDBC SQL Connector). - MongoDB (make sure you have `hazelcast-jet-mongodb` artifact included on the classpath). -== Related Resources +== Related resources - To monitor MapStores for each loaded entry, use the `EntryLoadedListener` interface. See the xref:events:object-events.adoc#listening-for-map-events[Listening for Map Events section] to learn how you can catch entry-based events. - xref:mapstore-triggers.adoc[]. -== Next Steps +== Next steps -See the MapStore xref:configuration-guide.adoc[configuration guide] for details about configuration options, including caching behaviors. +See the xref:configuration-guide.adoc[MapStore configuration guide] for details about configuration options, including caching behaviors. diff --git a/docs/modules/mapstore/pages/configuring-a-generic-mapstore.adoc b/docs/modules/mapstore/pages/configuring-a-generic-mapstore.adoc index f24407057..77f146d94 100644 --- a/docs/modules/mapstore/pages/configuring-a-generic-mapstore.adoc +++ b/docs/modules/mapstore/pages/configuring-a-generic-mapstore.adoc @@ -1,16 +1,37 @@ -= Using the Generic MapStore += Using the generic MapStore :description: With the xref:working-with-external-data.adoc#options[generic MapStore], you can configure a map to cache data from and write data back to an external system. This topic includes an example of how to configure a map with a generic MapStore that connects to a MySQL database. :page-beta: false {description} +NOTE: The objects created in the distributed map are stored as GenericRecord. You can use the `type-name` property to store the data in a POJO (Plain Old Java Object). + For a list of all supported external systems, including databases, see available xref:external-data-stores:external-data-stores.adoc#connectors[data connection types]. -== Before you Begin +== Before you begin You need a xref:external-data-stores:external-data-stores.adoc[data connection] that's configured on all cluster members. -== Quickstart Configuration +== Add dependencies + +If you are using a Hazelcast JAR file, you need to ensure the following is added to your classpath: + +[source,xml] +---- + + com.hazelcast + hazelcast-sql + + + + com.hazelcast + hazelcast-mapstore + +---- + +NOTE: If you are using the slim distribution, you need to add `hazelcast-mapstore`. If you are using MongoDb, you also need to add `hazelcast-jet-mongodb`. + +== Quickstart configuration This example shows a basic map configuration that uses a data connection called `my-mysql-database`. See xref:data-structures:map.adoc[] for the details of other properties that you include in your map configuration. @@ -70,11 +91,11 @@ instance().getConfig().addMapConfig(mapConfig); <2> The name of your data connection. [[mapping]] -== SQL Mapping for the Generic MapStore +== SQL mapping for the generic MapStore -When you configure a map with the generic MapStore, Hazelcast creates a xref:sql:mapping-to-jdbc.adoc[SQL mapping with the JDBC connector]. The name of the mapping is the same name as your map prefixed with `__map-store.`. This mapping is used to read data from or write data to the external system and it is removed whenever the configured map is removed. You can also configure this SQL mapping, using <>. +When you configure a map with the generic MapStore, Hazelcast creates a xref:sql:mapping-to-jdbc.adoc[SQL mapping with the JDBC connector]. The name of the mapping is the same name as your map prefixed with `__map-store.`. This mapping is used to read data from or write data to the external system and is removed whenever the configured map is removed. You can also configure this SQL mapping, using <>. -== Configuration Properties for the Generic MapStore +== Configuration properties for the generic MapStore These configuration properties allow you to configure the generic MapStore and its SQL mapping. @@ -436,14 +457,14 @@ mapConfig.setMapStoreConfig(mapStoreConfig); == Supported backends -GenericMapStore needs a SQL Connector that supports `SELECT`, `UPDATE`, `SINK INTO` and `DELETE` statements. +The generic MapStore needs a SQL Connector that supports `SELECT`, `UPDATE`, `SINK INTO` and `DELETE` statements. Officially supported connectors: - MySQL, PostgreSQL, Microsoft SQL Server, Oracle (it uses JDBC SQL Connector). - MongoDB (make sure you have `hazelcast-jet-mongodb` artifact included on the classpath). -== Related Resources +== Related resources - To monitor MapStores for each loaded entry, use the `EntryLoadedListener` interface. See the xref:events:object-events.adoc#listening-for-map-events[Listening for Map Events section] to learn how you can catch entry-based events. @@ -451,4 +472,4 @@ Officially supported connectors: == Next Steps -See the MapStore xref:configuration-guide.adoc[configuration guide] for details about configuration options, including caching behaviors. +See the xref:configuration-guide.adoc[MapStore configuration guide] for details about configuration options, including caching behaviors.