kafka-topics --bootstrap-server localhost:9092 --list
kafka-topics --bootstrap-server localhost:9092 --delete --topic topic-message
## solution to problem 1 | |
def is_palindrome(n): | |
if n < 0: | |
return False | |
s = str(n) | |
flag = 0 | |
for c in s[:len(s)/2]: |
@EnableCaching | |
@Configuration | |
public class RedisConfig { | |
private final RedisSerializer<String> stringSerializer = RedisSerializer.string(); | |
private final RedisSerializer<Object> objectRedisSerializer = RedisSerializer.json(); | |
private final Duration ttl = Duration.ofHours(6); |
@Service | |
@Slf4j | |
public class KeyValuePairServiceImpl implements KeyValuePairService { | |
private final KeyValuePairRepository keyValuePairRepository; | |
public KeyValuePairServiceImpl(KeyValuePairRepository keyValuePairRepository) { | |
this.keyValuePairRepository = keyValuePairRepository; | |
} | |
@Override |
@Service | |
@Slf4j | |
public class KeyValuePairServiceImpl implements KeyValuePairService { | |
private final KeyValuePairRepository keyValuePairRepository; | |
private final RedisTemplate<String, Object> redisTemplate; | |
private final ObjectMapper objectMapper; | |
public KeyValuePairServiceImpl(KeyValuePairRepository keyValuePairRepository, RedisTemplate<String, Object> redisTemplate) { | |
this.keyValuePairRepository = keyValuePairRepository; | |
this.redisTemplate = redisTemplate; |
@Data | |
@Entity | |
@AllArgsConstructor | |
@NoArgsConstructor | |
@Builder | |
public class KeyValuePair { | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
protected Long id; | |
private String key; |
public class ApplicationUser { | |
@DocumentId | |
private String id; | |
private String username; | |
private String password; | |
private String imageUrl; | |
private String bio; | |
} |
@Repository | |
public class UserRepository extends AbstractFirestoreRepository<User> { | |
protected UserRepository(Firestore firestore) { | |
super(firestore, "User"); | |
} | |
} |
@Slf4j | |
public abstract class AbstractFirestoreRepository<T> { | |
private final CollectionReference collectionReference; | |
private final String collectionName; | |
private final Class<T> parameterizedType; | |
protected AbstractFirestoreRepository(Firestore firestore, String collection) { | |
this.collectionReference = firestore.collection(collection); | |
this.collectionName = collection; | |
this.parameterizedType = getParameterizedType(); |
@Retention(RetentionPolicy.RUNTIME) | |
@Target(ElementType.FIELD) | |
public @interface DocumentId { | |
} |