Author: btellier
Date: Sat Nov 28 13:02:59 2015
New Revision: 1716959
URL: http://svn.apache.org/viewvc?rev=1716959&view=rev
Log:
MAILBOX-211 Interfaces abstracting a publisher - subscribing system
Added:
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageConsumer.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageReceiver.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java
Added:
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageConsumer.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageConsumer.java?rev=1716959&view=auto
==============================================================================
---
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageConsumer.java
(added)
+++
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageConsumer.java
Sat Nov 28 13:02:59 2015
@@ -0,0 +1,33 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.publisher;
+
+/**
+ * Will consume messages from exterior sources for the given MessageReceiver
+ */
+public interface MessageConsumer {
+
+ void setMessageReceiver(MessageReceiver messageReceiver);
+
+ void init(Topic topic) throws Exception;
+
+ void destroy() throws Exception;
+
+}
Added:
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageReceiver.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageReceiver.java?rev=1716959&view=auto
==============================================================================
---
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageReceiver.java
(added)
+++
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/MessageReceiver.java
Sat Nov 28 13:02:59 2015
@@ -0,0 +1,26 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.publisher;
+
+public interface MessageReceiver {
+
+ void receiveSerializedEvent(byte[] serializedEvent);
+
+}
Added:
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java?rev=1716959&view=auto
==============================================================================
---
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java
(added)
+++
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java
Sat Nov 28 13:02:59 2015
@@ -0,0 +1,35 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.publisher;
+
+import java.io.Closeable;
+
+/**
+ * The Publisher can be used to send information outside James.
+ *
+ * For instance you can send information to a message queue like Kafka or
perform a POST on a restful API
+ */
+public interface Publisher extends Closeable{
+
+ void publish(Topic topic, byte[] message);
+
+ void init();
+
+}
\ No newline at end of file
Added:
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java?rev=1716959&view=auto
==============================================================================
---
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java
(added)
+++
james/project/trunk/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java
Sat Nov 28 13:02:59 2015
@@ -0,0 +1,47 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.publisher;
+
+import com.google.common.base.Objects;
+
+public class Topic {
+
+ private final String value;
+
+ public Topic(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null || getClass() != o.getClass()) return false;
+ Topic topic = (Topic) o;
+ return Objects.equal(this.value, topic.value);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(value);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]