-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Xharos
committed
May 18, 2024
1 parent
ad43d01
commit d2da491
Showing
5 changed files
with
195 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,4 +72,5 @@ public interface NetOutput { | |
|
||
void writeVarLong(long l) throws IOException; | ||
|
||
byte[] getBuffer(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/main/java/fr/islandswars/commons/service/rabbitmq/ConsumerHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package fr.islandswars.commons.service.rabbitmq; | ||
|
||
import com.rabbitmq.client.*; | ||
import fr.islandswars.commons.network.NetInput; | ||
import fr.islandswars.commons.network.nio.InputByteBuffer; | ||
|
||
import java.io.IOException; | ||
import java.nio.ByteBuffer; | ||
|
||
/** | ||
* File <b>ConsumerHandler</b> located on fr.islandswars.commons.service.rabbitmq | ||
* ConsumerHandler is a part of commons. | ||
* <p> | ||
* Copyright (c) 2017 - 2024 Islands Wars. | ||
* <p> | ||
* commons is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* <p> | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* <p> | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <a href="http://www.gnu.org/licenses/">GNU license</a>. | ||
* <p> | ||
* | ||
* @author Jangliu, {@literal <[email protected]>} | ||
* Created the 18/05/2024 at 21:50 | ||
* @since 0.1 | ||
*/ | ||
public abstract class ConsumerHandler implements Consumer { | ||
|
||
protected final String id; | ||
protected String tag; | ||
protected Channel channel; | ||
|
||
public ConsumerHandler(String queueName) { | ||
this.id = queueName; | ||
} | ||
|
||
@Override | ||
public void handleConsumeOk(String consumerTag) { | ||
|
||
} | ||
|
||
@Override | ||
public void handleCancelOk(String consumerTag) { | ||
|
||
} | ||
|
||
@Override | ||
public void handleCancel(String consumerTag) throws IOException { | ||
|
||
} | ||
|
||
@Override | ||
public void handleShutdownSignal(String consumerTag, ShutdownSignalException sig) { | ||
|
||
} | ||
|
||
@Override | ||
public void handleRecoverOk(String consumerTag) { | ||
|
||
} | ||
|
||
@Override | ||
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { | ||
var buffer = new InputByteBuffer(ByteBuffer.wrap(body)); | ||
handleDelivery(envelope, buffer); | ||
} | ||
|
||
public abstract void handleDelivery(Envelope envelope, NetInput output); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters