org.springframework.data.cassandra.core.CassandraOperations Java Examples
The following examples show how to use
org.springframework.data.cassandra.core.CassandraOperations.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateTableLinstener.java From framework with Apache License 2.0 | 5 votes |
private void createTableIfNotExist(CassandraOperations cassandraOperations) { try { cassandraOperations.getCqlOperations().execute("select id from t_tx_check_info limit 1"); return; } catch (Exception e) { LoggerUtil.error(e); } String cqls = IOUtil.readString(this.getClass().getClassLoader().getResourceAsStream("setup.cql")); if (StringUtils.isNotEmpty(cqls)) { for (String cql : StringUtils.split(cqls, ";")) { cql = StringUtils.trim(cql); if (StringUtils.isNotEmpty(cql)) { cassandraOperations.getCqlOperations().execute(cql); LoggerUtil.info("执行[{0}]成功", cql); } } } }
Example #2
Source File: CassandraZuulStoreAutoConfiguration.java From zuul-route-cassandra-spring-cloud-starter with Apache License 2.0 | 3 votes |
@Bean @ConditionalOnMissingBean public ZuulRouteStore cassandraZuulRouteStore(CassandraOperations cassandraOperations) { return new CassandraZuulRouteStore(cassandraOperations); }
Example #3
Source File: CassandraZuulRouteStore.java From zuul-route-cassandra-spring-cloud-starter with Apache License 2.0 | 3 votes |
/** * Creates new instance of {@link CassandraZuulRouteStore}. * * @param cassandraOperations the cassandra template * @param keyspace the optional keyspace * @param table the table name * @throws IllegalArgumentException if {@code keyspace} is {@code null} * or {@code table} is {@code null} or empty */ public CassandraZuulRouteStore(CassandraOperations cassandraOperations, String keyspace, String table) { Assert.notNull(cassandraOperations, "Parameter 'cassandraOperations' can not be null."); Assert.hasLength(table, "Parameter 'table' can not be empty."); this.cassandraOperations = cassandraOperations; this.keyspace = keyspace; this.table = table; }
Example #4
Source File: CassandraZuulProxyStoreTest.java From zuul-route-cassandra-spring-cloud-starter with Apache License 2.0 | 3 votes |
@Bean public CassandraOperations cassandraTemplate(Cluster cluster) { return new CassandraTemplate(cluster.connect("zuul")); }
Example #5
Source File: Main.java From blog with MIT License | 3 votes |
@Bean public CassandraOperations cassandraTemplate() throws Exception { return new CassandraTemplate(session().getObject()); }
Example #6
Source File: CreateTableLinstener.java From framework with Apache License 2.0 | 2 votes |
/** * Description: <br> * * @author 王伟<br> * @taskId <br> * @param context <br> */ @Override public void complete(final ApplicationContext context) { CassandraOperations cassandraOperations = context.getBean(CassandraOperations.class); createTableIfNotExist(cassandraOperations); }
Example #7
Source File: CassandraZuulRouteStore.java From zuul-route-cassandra-spring-cloud-starter with Apache License 2.0 | 2 votes |
/** * Creates new instance of {@link CassandraZuulRouteStore}. * * @param cassandraOperations the cassandra template */ public CassandraZuulRouteStore(CassandraOperations cassandraOperations) { this(cassandraOperations, null, DEFAULT_TABLE_NAME); }