Re: singleton with autocloseable

2021-09-16 Thread Jonathan Gallimore
Ah, perfect. Thanks for letting me know! Jon On Thu, Sep 16, 2021 at 2:00 PM Matthew Broadhead wrote: > sorry i forgot to follow up. docker was running out of disk space. it > is working now > > On 16/09/2021 13:02, Jonathan Gallimore wrote: > > Thanks for the stacktrace - I'll see if I can re

Re: singleton with autocloseable

2021-09-16 Thread Matthew Broadhead
sorry i forgot to follow up.  docker was running out of disk space. it is working now On 16/09/2021 13:02, Jonathan Gallimore wrote: Thanks for the stacktrace - I'll see if I can reproduce that here. That AutoConnectionTracker should kick in if a connection from the resource adapter isn't close

Re: singleton with autocloseable

2021-09-16 Thread Jonathan Gallimore
Thanks for the stacktrace - I'll see if I can reproduce that here. That AutoConnectionTracker should kick in if a connection from the resource adapter isn't closed before it goes out of scope. In theory, it should close the connection for you and clean up, so it sounds like something isn't happenin

Re: singleton with autocloseable

2021-09-08 Thread Matthew Broadhead
Hi Jon, My resource adapter keeps getting clogged and needs to be restarted.  Any idea what might cause that?  The console is like 08-Sep-2021 10:47:07.079 INFO [ajp-nio-0.0.0.0-8009-exec-37] org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor.doRemove Removing ManagedConnect

Re: singleton with autocloseable

2021-08-02 Thread Matthew Broadhead
Hi Jon,  Thanks!  I might have updated the test a few times while experimenting so looking at an older commit would show the original. On 02/08/2021 13:55, Jonathan Gallimore wrote: I haven't had a chance to try yet - I'll take a look at the test you pointed out. Jon On Wed, Jul 28, 2021 at 8

Re: singleton with autocloseable

2021-08-02 Thread Jonathan Gallimore
I haven't had a chance to try yet - I'll take a look at the test you pointed out. Jon On Wed, Jul 28, 2021 at 8:35 PM Matthew Broadhead wrote: > Is it possible to mock an RA during testing with ApplicationComposer? > it isn't possible to run any tests without errors once it is used in the > pro

Re: singleton with autocloseable

2021-07-28 Thread Matthew Broadhead
Is it possible to mock an RA during testing with ApplicationComposer?  it isn't possible to run any tests without errors once it is used in the program as far as i can see On 07/07/2021 08:56, Matthew Broadhead wrote: Romain has pointer me to this file which seems to do what I want but I can't

Re: singleton with autocloseable

2021-07-06 Thread Matthew Broadhead
Romain has pointer me to this file which seems to do what I want but I can't make it work https://github.com/apache/tomee/blob/861e65ba7fe11f28c52a020f26bfe368a294f665/container/openejb-core/src/test/java/org/apache/openejb/config/ConnectorProxyTest.java I can't get any of my other tests running

Re: singleton with autocloseable

2021-07-02 Thread Matthew Broadhead
using the example from https://tomee.apache.org/master/examples/rest-applicationcomposer-mockito.html i tried: @Mock private NATSConnectionFactory cf; @MockInjector public Class mockitoInjector() {     return MockitoInjector.class; } but it still gives the same error On 28/06/2021 23:32, Jon

Re: singleton with autocloseable

2021-07-01 Thread Matthew Broadhead
https://github.com/chongma/tomee-chatterbox/blob/master/chatterbox-nats/chatterbox-nats-sample-war/src/test/java/org/superbiz/SenderTest.java On 28/06/2021 23:32, Jonathan Gallimore wrote: Do you have a test you can post? Off the top of my head, I'm not sure, but I imagine we can figure somethin

Re: singleton with autocloseable

2021-07-01 Thread Matthew Broadhead
Hi Jon, I have added a test which fails in the same way as mine at https://github.com/chongma/tomee-chatterbox in chatterbox-nats-sample-war Yes it is my first commit.  Thanks :) Matthew On 28/06/2021 23:32, Jonathan Gallimore wrote: Do you have a test you can post? Off the top of my head,

Re: singleton with autocloseable

2021-06-28 Thread Jonathan Gallimore
Do you have a test you can post? Off the top of my head, I'm not sure, but I imagine we can figure something out. P.S. thanks for the PR - I merged it in. Is that your first TomEE commit? If so, congratulations :) Jon On Mon, 28 Jun 2021, 22:04 Matthew Broadhead, wrote: > Hi Jon, > > Have you

Re: singleton with autocloseable

2021-06-28 Thread Matthew Broadhead
Hi Jon, Have you got any tips for mocking the NATSConnectionFactory?  I am trying to start doing some tests with SingleApplicationComposerRunner and I get org.apache.openejb.OpenEJBException: Can't find resource for class tld.domain.controllers.message.SchedulerController#cf. (No provider a

Re: singleton with autocloseable

2021-06-24 Thread Matthew Broadhead
Thanks for providing that example.  I am away from my computer but I will do the PR on Monday.  It is already working much better with JCA in development On 23/06/2021 15:43, Jonathan Gallimore wrote: Managed to figure out my config mistakes, and pushed an example with the resource adapter emb

Re: singleton with autocloseable

2021-06-23 Thread Jonathan Gallimore
Managed to figure out my config mistakes, and pushed an example with the resource adapter embedded in the .war file: https://github.com/apache/tomee-chatterbox/commit/18290594eb924c0a0625f7560e096635d8b92416 Hope that helps! Jon On Wed, Jun 23, 2021 at 12:14 PM Jonathan Gallimore < jonathan.gall

Re: singleton with autocloseable

2021-06-23 Thread Jonathan Gallimore
Hi Matthew Can you submit a PR against https://github.com/apache/tomee-chatterbox? Looking into embedding the rar into the webapp, but as it stands right at the moment, I'm either doing something wrong, or hitting an unusual bug with the resource creation. I'm debugging through it. Jon On Fri,

Re: singleton with autocloseable

2021-06-17 Thread Matthew Broadhead
I have pointed WST to the TomEE install and that works fine.  it might be nice to embed the rar into the webapp.  does that work for production as well? where do i submit the PR? https://github.com/jgallimore/tomee-chatterbox or https://github.com/apache/tomee-chatterbox ?  it is by no means

Re: singleton with autocloseable

2021-06-17 Thread Jonathan Gallimore
On Thu, Jun 17, 2021 at 1:48 PM Matthew Broadhead wrote: > i added ackWait and durableName as Strings in NATSActivationSpec so it > is working for me ok. > Very nice! Can you send a PR for that? I'll get it merged in. Nice work :). > i have managed to deploy TomEE with docker fine. But when d

Re: singleton with autocloseable

2021-06-17 Thread Matthew Broadhead
i added ackWait and durableName as Strings in NATSActivationSpec so it is working for me ok. i have managed to deploy TomEE with docker fine.  But when deploying with Eclipse WST I have to manually copy the rar into the apps folder in org.eclipse.wst.server.core.  Is there a way to automate th

Re: singleton with autocloseable

2021-06-17 Thread Matthew Broadhead
maybe it is possible to put the Subscription option in the NATSActivationSpec On 17/06/2021 09:43, Matthew Broadhead wrote: Hi Jon, I was wondering how to set the SubscriptionOptions.  If you look at the example below they are the third argument to the subscribe function after the MessageHan

Re: singleton with autocloseable

2021-06-17 Thread Matthew Broadhead
Hi Jon, I was wondering how to set the SubscriptionOptions.  If you look at the example below they are the third argument to the subscribe function after the MessageHandler.  In my case I might want to have control over the ackWait time and switch between manualAcks and autoAcks.  The durable

Re: singleton with autocloseable

2021-06-16 Thread Matthew Broadhead
ah ok i have found the readme at https://github.com/apache/tomee-chatterbox/blob/master/chatterbox-nats/README.adoc On 16/06/2021 20:00, Matthew Broadhead wrote: Hi Jon, Thanks for all the effort you have put in.  Looking at the latest commit I can't see any change to the readme file or any c

Re: singleton with autocloseable

2021-06-16 Thread Matthew Broadhead
Hi Jon, Thanks for all the effort you have put in.  Looking at the latest commit I can't see any change to the readme file or any configuration in the war project.  Is it possible I am looking at the wrong branch? That would be great if it is released and I can get it through maven On 16/06/

Re: singleton with autocloseable

2021-06-16 Thread Jonathan Gallimore
Pushed. I've made client Id and cluster id configuration options and added a README. If it working for you, I'd suggest we cut a 0.3 release unless there are any objections. Jon On Wed, Jun 16, 2021 at 12:16 PM Jonathan Gallimore < jonathan.gallim...@gmail.com> wrote: > Sorry, tied up with a cou

Re: singleton with autocloseable

2021-06-16 Thread Jonathan Gallimore
Sorry, tied up with a couple of things here. Literally just opened the IDE to finish this off. :) Jon On Wed, Jun 16, 2021 at 9:46 AM Matthew Broadhead wrote: > hi Jon, > > Is there anything else you need from my end? It feels like it is nearly > finished. Could it pass the parameters in a si

Re: singleton with autocloseable

2021-06-16 Thread Matthew Broadhead
hi Jon, Is there anything else you need from my end?  It feels like it is nearly finished.  Could it pass the parameters in a similar way to how it is done in the chatterbox-imap?  sending them in from the tomee.xml? On 10/06/2021 19:07, Jonathan Gallimore wrote: Thank you! That worked. I h

Re: singleton with autocloseable

2021-06-11 Thread Matthew Broadhead
That looks great.  I can't wait to get it integrated into my project.  It looks a lot more solid than what I was attempting with threads. It would be good if the path, port and cluster id for the nats server could be configured and then the client id also as this has to be unique.  there may b

Re: singleton with autocloseable

2021-06-10 Thread Jonathan Gallimore
Thank you! That worked. I have pushed an update to my code, and I've been able to send a message to NATS from a REST endpoint, and receive a message from NATS via an MDB. I still need to extract the cluster ID and client ID into properties for the resource adapter, and of course, try and write up

Re: singleton with autocloseable

2021-06-09 Thread Matthew Broadhead
hi, it was my fault putting a confusing value in the docker compose file.  it should work like this StreamingConnectionFactory cf = new  StreamingConnectionFactory(new Options.Builder().natsUrl("nats://localhost:4222")  .clusterId("yourclientid").clientId("anything").build()); but you could c

Re: singleton with autocloseable

2021-06-09 Thread Jonathan Gallimore
Thanks. If I can get that test going, I can probably get the rest working. I suspect there are some other bugs in there. Jon On Wed, Jun 9, 2021 at 4:04 PM Matthew Broadhead wrote: > Thanks I will have a look now > > On 09/06/2021 15:19, Jonathan Gallimore wrote: > > Ok, I'm stuck. If I boot up

Re: singleton with autocloseable

2021-06-09 Thread Matthew Broadhead
Thanks I will have a look now On 09/06/2021 15:19, Jonathan Gallimore wrote: Ok, I'm stuck. If I boot up a NATS server with your docker-compose.yml file, and run the following test: @Test public void testShouldConnect() throws Exception { StreamingConnectionFactory cf = new

Re: singleton with autocloseable

2021-06-09 Thread Jonathan Gallimore
Ok, I'm stuck. If I boot up a NATS server with your docker-compose.yml file, and run the following test: @Test public void testShouldConnect() throws Exception { StreamingConnectionFactory cf = new StreamingConnectionFactory(new Options.Builder().natsUrl("nats://loc

Re: singleton with autocloseable

2021-06-09 Thread Jonathan Gallimore
Nervermind, I figured out my mistake. I'll post back when I have something going. Jon On Wed, Jun 9, 2021 at 11:44 AM Jonathan Gallimore < jonathan.gallim...@gmail.com> wrote: > I think I have something wired up, but when executing this: > > cf = new > StreamingCo

Re: singleton with autocloseable

2021-06-09 Thread Jonathan Gallimore
I think I have something wired up, but when executing this: cf = new StreamingConnectionFactory(new Options.Builder().natsUrl(baseAddress) .clusterId("cluster-id").clientId("client-id").build()); connection = cf.createConnection();

Re: singleton with autocloseable

2021-06-09 Thread Matthew Broadhead
i have never used a JCA adapter before.  is it loaded in using the tomee.xml as a Resource?  and then injected into a singleton for subscribing to messages? On 08/06/2021 17:15, Jonathan Gallimore wrote: Definitely sounds like a good case for a JCA adapter. I'll take a quick swing at hooking u

Re: singleton with autocloseable

2021-06-08 Thread Jonathan Gallimore
Definitely sounds like a good case for a JCA adapter. I'll take a quick swing at hooking up an example for you. Jon On Tue, Jun 8, 2021 at 9:02 AM Matthew Broadhead wrote: > Hi Jon, > > NATS is basically a message queue, like ActiveMQ I suppose. > > I included the adapter into the project using

Re: singleton with autocloseable

2021-06-08 Thread Matthew Broadhead
Hi Jon, NATS is basically a message queue, like ActiveMQ I suppose. I included the adapter into the project using maven io.nats java-nats-streaming 2.2.3 i started up a nats server using docker.  here is my docker-compose.yml version: '3.1' services:   nats-docker:     image: n

Re: singleton with autocloseable

2021-06-07 Thread Jonathan Gallimore
At the risk of sounding a bit ignorant... what is NATS? >From what I can tell, it sounds like you're receiving a stream of events (over websocket) and want to do some processing in an EJB or CDI bean for each event. The connection to the NATS server isn't in the context of a HTTP (or any other typ