Commit 1da32793e1d3a9968fc7ce524988d12a6e7ba1af

Authored by vparomskiy
1 parent f1a4c683

RuleEngine Cassandra queue API

Showing 23 changed files with 535 additions and 0 deletions
@@ -548,3 +548,55 @@ CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.event_by_id AS @@ -548,3 +548,55 @@ CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.event_by_id AS
548 AND event_type IS NOT NULL AND event_uid IS NOT NULL 548 AND event_type IS NOT NULL AND event_uid IS NOT NULL
549 PRIMARY KEY ((tenant_id, entity_type, entity_id), id, event_type, event_uid) 549 PRIMARY KEY ((tenant_id, entity_type, entity_id), id, event_type, event_uid)
550 WITH CLUSTERING ORDER BY (id ASC, event_type ASC, event_uid ASC); 550 WITH CLUSTERING ORDER BY (id ASC, event_type ASC, event_uid ASC);
  551 +
  552 +CREATE TABLE IF NOT EXISTS thingsboard.msg_queue (
  553 + node_id timeuuid,
  554 + clustered_hash bigint,
  555 + partition bigint,
  556 + ts bigint,
  557 + msg blob,
  558 + PRIMARY KEY ((node_id, cluster_hash, partition), ts)
  559 + WITH CLUSTERING ORDER BY (ts DESC)
  560 + AND compaction = {
  561 + 'class': 'org.apache.cassandra.db.compaction.DateTieredCompactionStrategy',
  562 + 'min_threshold': '5',
  563 + 'base_time_seconds': '43200',
  564 + 'max_window_size_seconds': '43200'
  565 + 'tombstone_threshold': '0.9',
  566 + 'unchecked_tombstone_compaction': 'true',
  567 + };
  568 +);
  569 +
  570 +CREATE TABLE IF NOT EXISTS thingsboard.msg_ack_queue (
  571 + node_id timeuuid,
  572 + clustered_hash bigint,
  573 + partition bigint,
  574 + ts bigint,
  575 + msg_id timeuuid,
  576 + PRIMARY KEY ((node_id, cluster_hash, partition), ts)
  577 + WITH CLUSTERING ORDER BY (ts DESC)
  578 + AND compaction = {
  579 + 'class': 'org.apache.cassandra.db.compaction.DateTieredCompactionStrategy',
  580 + 'min_threshold': '5',
  581 + 'base_time_seconds': '43200',
  582 + 'max_window_size_seconds': '43200'
  583 + 'tombstone_threshold': '0.9',
  584 + 'unchecked_tombstone_compaction': 'true',
  585 + };
  586 +);
  587 +
  588 +CREATE TABLE IF NOT EXISTS thingsboard.processed_msg_partitions (
  589 + node_id timeuuid,
  590 + clustered_hash bigint,
  591 + partition bigint,
  592 + PRIMARY KEY ((node_id, cluster_hash), partition)
  593 + WITH CLUSTERING ORDER BY (partition DESC)
  594 + AND compaction = {
  595 + 'class': 'org.apache.cassandra.db.compaction.DateTieredCompactionStrategy',
  596 + 'min_threshold': '5',
  597 + 'base_time_seconds': '43200',
  598 + 'max_window_size_seconds': '43200'
  599 + 'tombstone_threshold': '0.9',
  600 + 'unchecked_tombstone_compaction': 'true',
  601 + };
  602 +);
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.rule.engine.api;
  17 +
  18 +import com.google.common.util.concurrent.ListenableFuture;
  19 +
  20 +import java.util.UUID;
  21 +
  22 +public interface MsqQueue {
  23 +
  24 + ListenableFuture<Void> put(TbMsg msg, UUID nodeId, long clusteredHash);
  25 +
  26 + ListenableFuture<Void> ack(TbMsg msg, UUID nodeId, long clusteredHash);
  27 +
  28 + Iterable<TbMsg> findUnprocessed(UUID nodeId, long clusteredHash);
  29 +}
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.api; 16 package org.thingsboard.rule.engine.api;
2 17
3 import org.thingsboard.server.common.msg.cluster.ServerAddress; 18 import org.thingsboard.server.common.msg.cluster.ServerAddress;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.api; 16 package org.thingsboard.rule.engine.api;
2 17
3 import lombok.Data; 18 import lombok.Data;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.api; 16 package org.thingsboard.rule.engine.api;
2 17
3 import lombok.Data; 18 import lombok.Data;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.api; 16 package org.thingsboard.rule.engine.api;
2 17
3 import java.util.concurrent.ExecutionException; 18 import java.util.concurrent.ExecutionException;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.api; 16 package org.thingsboard.rule.engine.api;
2 17
3 import com.fasterxml.jackson.databind.JsonNode; 18 import com.fasterxml.jackson.databind.JsonNode;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.api; 16 package org.thingsboard.rule.engine.api;
2 17
3 import com.fasterxml.jackson.core.JsonProcessingException; 18 import com.fasterxml.jackson.core.JsonProcessingException;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.api; 16 package org.thingsboard.rule.engine.api;
2 17
3 /** 18 /**
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine; 16 package org.thingsboard.rule.engine;
2 17
3 import com.fasterxml.jackson.core.JsonProcessingException; 18 import com.fasterxml.jackson.core.JsonProcessingException;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.filter; 16 package org.thingsboard.rule.engine.filter;
2 17
3 import lombok.extern.slf4j.Slf4j; 18 import lombok.extern.slf4j.Slf4j;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.filter; 16 package org.thingsboard.rule.engine.filter;
2 17
3 import lombok.Data; 18 import lombok.Data;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.metadata; 16 package org.thingsboard.rule.engine.metadata;
2 17
3 import lombok.extern.slf4j.Slf4j; 18 import lombok.extern.slf4j.Slf4j;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.metadata; 16 package org.thingsboard.rule.engine.metadata;
2 17
3 import lombok.Data; 18 import lombok.Data;
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.rule.engine.queue.cassandra;
  17 +
  18 +import org.springframework.stereotype.Component;
  19 +import org.thingsboard.rule.engine.api.TbMsg;
  20 +
  21 +import java.util.UUID;
  22 +
  23 +@Component
  24 +public class AckBuilder {
  25 +
  26 + public MsgAck build(TbMsg msg, UUID nodeId, long clusteredHash) {
  27 + return null;
  28 + }
  29 +}
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.rule.engine.queue.cassandra;
  17 +
  18 +import com.google.common.collect.Lists;
  19 +import com.google.common.util.concurrent.ListenableFuture;
  20 +import org.springframework.beans.factory.annotation.Autowired;
  21 +import org.springframework.stereotype.Component;
  22 +import org.thingsboard.rule.engine.api.MsqQueue;
  23 +import org.thingsboard.rule.engine.api.TbMsg;
  24 +import org.thingsboard.rule.engine.queue.cassandra.repository.AckRepository;
  25 +import org.thingsboard.rule.engine.queue.cassandra.repository.MsgRepository;
  26 +import org.thingsboard.rule.engine.queue.cassandra.repository.ProcessedPartitionRepository;
  27 +
  28 +import java.util.Collections;
  29 +import java.util.List;
  30 +import java.util.Optional;
  31 +import java.util.UUID;
  32 +
  33 +@Component
  34 +public class CassandraMsqQueue implements MsqQueue {
  35 +
  36 + @Autowired
  37 + private MsgRepository msgRepository;
  38 +
  39 + @Autowired
  40 + private AckRepository ackRepository;
  41 +
  42 + @Autowired
  43 + private AckBuilder ackBuilder;
  44 +
  45 + @Autowired
  46 + private UnprocessedMsgFilter unprocessedMsgFilter;
  47 +
  48 + @Autowired
  49 + private ProcessedPartitionRepository processedPartitionRepository;
  50 +
  51 + @Override
  52 + public ListenableFuture<Void> put(TbMsg msg, UUID nodeId, long clusteredHash) {
  53 + return msgRepository.save(msg, nodeId, clusteredHash, getPartition(msg));
  54 + }
  55 +
  56 + @Override
  57 + public ListenableFuture<Void> ack(TbMsg msg, UUID nodeId, long clusteredHash) {
  58 + MsgAck ack = ackBuilder.build(msg, nodeId, clusteredHash);
  59 + return ackRepository.ack(ack);
  60 + }
  61 +
  62 + @Override
  63 + public Iterable<TbMsg> findUnprocessed(UUID nodeId, long clusteredHash) {
  64 + List<TbMsg> unprocessedMsgs = Lists.newArrayList();
  65 + for (Long partition : findUnprocessedPartitions(nodeId, clusteredHash)) {
  66 + Iterable<TbMsg> msgs = msgRepository.findMsgs(nodeId, clusteredHash, partition);
  67 + Iterable<MsgAck> acks = ackRepository.findAcks(nodeId, clusteredHash, partition);
  68 + unprocessedMsgs.addAll(unprocessedMsgFilter.filter(msgs, acks));
  69 + }
  70 + return unprocessedMsgs;
  71 + }
  72 +
  73 + private List<Long> findUnprocessedPartitions(UUID nodeId, long clusteredHash) {
  74 + Optional<Long> lastPartition = processedPartitionRepository.findLastProcessedPartition(nodeId, clusteredHash);
  75 + return Collections.emptyList();
  76 + }
  77 +
  78 + private long getPartition(TbMsg msg) {
  79 + return Long.MIN_VALUE;
  80 + }
  81 +
  82 +}
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.rule.engine.queue.cassandra;
  17 +
  18 +import lombok.Data;
  19 +
  20 +import java.util.UUID;
  21 +
  22 +@Data
  23 +public class MsgAck {
  24 +
  25 + private final UUID msgId;
  26 + private final UUID nodeId;
  27 + private final long clusteredHash;
  28 + private final long partition;
  29 + private final long ts;
  30 +
  31 +}
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.rule.engine.queue.cassandra;
  17 +
  18 +import org.thingsboard.rule.engine.api.TbMsg;
  19 +
  20 +import java.util.Collection;
  21 +import java.util.Collections;
  22 +
  23 +public class UnprocessedMsgFilter {
  24 +
  25 + public Collection<TbMsg> filter(Iterable<TbMsg> msgs, Iterable<MsgAck> acks) {
  26 + return Collections.emptyList();
  27 + }
  28 +}
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.rule.engine.queue.cassandra.repository;
  17 +
  18 +import com.google.common.util.concurrent.ListenableFuture;
  19 +import org.thingsboard.rule.engine.queue.cassandra.MsgAck;
  20 +
  21 +import java.util.UUID;
  22 +
  23 +public interface AckRepository {
  24 +
  25 + ListenableFuture<Void> ack(MsgAck msgAck);
  26 +
  27 + Iterable<MsgAck> findAcks(UUID nodeId, long clusteredHash, long partition);
  28 +}
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.rule.engine.queue.cassandra.repository;
  17 +
  18 +import com.google.common.util.concurrent.ListenableFuture;
  19 +import org.thingsboard.rule.engine.api.TbMsg;
  20 +
  21 +import java.util.UUID;
  22 +
  23 +public interface MsgRepository {
  24 +
  25 + ListenableFuture<Void> save(TbMsg msg, UUID nodeId, long clusteredHash, long partition);
  26 +
  27 + Iterable<TbMsg> findMsgs(UUID nodeId, long clusteredHash, long partition);
  28 +
  29 +}
  1 +package org.thingsboard.rule.engine.queue.cassandra.repository;
  2 +
  3 +import java.util.Optional;
  4 +import java.util.UUID;
  5 +
  6 +public interface ProcessedPartitionRepository {
  7 +
  8 + void partitionProcessed(UUID nodeId, long clusteredHash, long partition);
  9 +
  10 + Optional<Long> findLastProcessedPartition(UUID nodeId, long clusteredHash);
  11 +
  12 +}
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.rule.engine.queue.jpa;
  17 +
  18 +//@todo-vp: implement
  19 +public class SqlMsgQueue {
  20 +}
  1 +/**
  2 + * Copyright © 2016-2017 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
1 package org.thingsboard.rule.engine.transform; 16 package org.thingsboard.rule.engine.transform;
2 17
3 import lombok.extern.slf4j.Slf4j; 18 import lombok.extern.slf4j.Slf4j;