This file contains hidden or 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
web: java $JAVA_OPTS -jar target/*.jar |
This file contains hidden or 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
$ heroku login | |
$ heroku keys:add ~/.ssh/id_rsa.pub |
This file contains hidden or 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
server.port: ${port:8080} |
This file contains hidden or 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
$ mvn clean install | |
$ java -jar target/*.jar // will start on 8080, with --port=<PORT> you can customize | |
$ curl http://localhost:8080/greeting?name=Zoltan | |
$ Hello Zoltan |
This file contains hidden or 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
$ heroku ps:scale web=0 //scale the web dynos down to zero which effectively takes all your app http-processes offline | |
$ heroku logout |
This file contains hidden or 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
public class Message { | |
private Event event; | |
private String sessionId; | |
private long time; | |
} |
This file contains hidden or 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
@Singleton | |
@ManagedService(path = "/event") | |
public class EventService { | |
} |
This file contains hidden or 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
BroadcasterFactory broadcasterFactory = BroadcasterFactory.getDefault(); | |
Broadcaster eventBroadcaster = broadcasterFactory.lookup("/event"); | |
Collection<AtmosphereResource> atmosphereResources = eventBroadcaster.getAtmosphereResources(); | |
for (AtmosphereResource atmosphereResource : atmosphereResources) { | |
if (message.getSessionId().equals(getSessionId(atmosphereResource))) { | |
eventBroadcaster.broadcast(message, atmosphereResource); | |
} | |
} |
This file contains hidden or 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
git clone https://github.com/altfatterz/atmosphere-fun | |
cd atmosphere-fun | |
mvn clean install | |
mvn jetty:run |
This file contains hidden or 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
public enum Event { | |
ACCOUNT_DEBITED, ACCOUNT_CREDITED, ACCOUNT_LOCKED | |
} |