| 360 | |
| 361 | #[test] |
| 362 | fn create_and_publish() { |
| 363 | let registry = TopicRegistry::new(1000); |
| 364 | assert!(registry.create_topic("orders").is_ok()); |
| 365 | assert!(registry.create_topic("orders").is_err()); // duplicate |
| 366 | |
| 367 | let (seq, _receivers) = registry |
| 368 | .publish("orders", "order-1".into(), "admin") |
| 369 | .unwrap(); |
| 370 | assert_eq!(seq, 1); |
| 371 | |
| 372 | let (seq, _receivers) = registry |
| 373 | .publish("orders", "order-2".into(), "admin") |
| 374 | .unwrap(); |
| 375 | assert_eq!(seq, 2); |
| 376 | } |
| 377 | |
| 378 | #[test] |
| 379 | fn subscribe_with_backlog() { |